diff options
author | Benjamin Lupton <b@lupton.cc> | 2020-06-24 12:32:43 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-23 22:32:43 -0400 |
commit | 49c54c0805ab26410a62e0251fee3a28b98c0e13 (patch) | |
tree | b9fcb2713622f2739557f2caffd51d8bb454300b /std/node/_fs/_fs_writeFile.ts | |
parent | d16337cc9c59732fe81655482e08b72d844472e6 (diff) |
fix(std/node): fix readFile types, add encoding types (#6451)
Diffstat (limited to 'std/node/_fs/_fs_writeFile.ts')
-rw-r--r-- | std/node/_fs/_fs_writeFile.ts | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/std/node/_fs/_fs_writeFile.ts b/std/node/_fs/_fs_writeFile.ts index 4ede42638..54bdb801c 100644 --- a/std/node/_fs/_fs_writeFile.ts +++ b/std/node/_fs/_fs_writeFile.ts @@ -3,6 +3,7 @@ import { notImplemented } from "../_utils.ts"; import { fromFileUrl } from "../path.ts"; import { + Encodings, WriteFileOptions, CallbackWithError, isFileOptions, @@ -14,12 +15,12 @@ import { export function writeFile( pathOrRid: string | number | URL, data: string | Uint8Array, - optOrCallback: string | CallbackWithError | WriteFileOptions | undefined, + optOrCallback: Encodings | CallbackWithError | WriteFileOptions | undefined, callback?: CallbackWithError ): void { const callbackFn: CallbackWithError | undefined = optOrCallback instanceof Function ? optOrCallback : callback; - const options: string | WriteFileOptions | undefined = + const options: Encodings | WriteFileOptions | undefined = optOrCallback instanceof Function ? undefined : optOrCallback; if (!callbackFn) { @@ -71,7 +72,7 @@ export function writeFile( export function writeFileSync( pathOrRid: string | number | URL, data: string | Uint8Array, - options?: string | WriteFileOptions + options?: Encodings | WriteFileOptions ): void { pathOrRid = pathOrRid instanceof URL ? fromFileUrl(pathOrRid) : pathOrRid; |