From 09ee9a828009ab1fbe59f611da64f48f9e9e573b Mon Sep 17 00:00:00 2001 From: Nikolai Vavilov Date: Sat, 6 Jun 2020 22:56:49 +0300 Subject: feat(std/node): Buffer (#5925) --- std/node/_fs/_fs_writeFile.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'std/node/_fs/_fs_writeFile.ts') 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") -- cgit v1.2.3