diff options
author | Nikolai Vavilov <vvnicholas@gmail.com> | 2020-06-06 22:56:49 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-06 15:56:49 -0400 |
commit | 09ee9a828009ab1fbe59f611da64f48f9e9e573b (patch) | |
tree | 9333c9878682afe2f473b0203afd9a63dc8fd820 /std/node/_fs/_fs_writeFile.ts | |
parent | 26287ef87b2b238e25a1ab44a43cde24eea15bfc (diff) |
feat(std/node): Buffer (#5925)
Diffstat (limited to 'std/node/_fs/_fs_writeFile.ts')
-rw-r--r-- | std/node/_fs/_fs_writeFile.ts | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/std/node/_fs/_fs_writeFile.ts b/std/node/_fs/_fs_writeFile.ts index 72e75c97a..4ede42638 100644 --- a/std/node/_fs/_fs_writeFile.ts +++ b/std/node/_fs/_fs_writeFile.ts @@ -7,6 +7,7 @@ import { CallbackWithError, isFileOptions, getEncoding, + checkEncoding, getOpenOptions, } from "./_fs_common.ts"; @@ -35,7 +36,7 @@ export function writeFile( ? options.mode : undefined; - const encoding = getEncoding(options) || "utf8"; + const encoding = checkEncoding(getEncoding(options)) || "utf8"; const openOptions = getOpenOptions(flag || "w"); if (typeof data === "string" && encoding === "utf8") @@ -82,7 +83,7 @@ export function writeFileSync( ? options.mode : undefined; - const encoding = getEncoding(options) || "utf8"; + const encoding = checkEncoding(getEncoding(options)) || "utf8"; const openOptions = getOpenOptions(flag || "w"); if (typeof data === "string" && encoding === "utf8") |