diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2024-06-11 12:41:44 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-11 11:41:44 +0000 |
commit | 6a356aff1380e79d67738c5b43aa2b5fee76600d (patch) | |
tree | be4aadc62a523ff280820958a1a3829f1a18ca7d /ext/node/polyfills/_fs/_fs_writeFile.ts | |
parent | 3d41b486da7dcba49c8a18b45425e356c329d986 (diff) |
chore: sync up Node.js test files for v20.11.1 (#24066)
Co-authored-by: Yoshiya Hinosawa <stibium121@gmail.com>
Diffstat (limited to 'ext/node/polyfills/_fs/_fs_writeFile.ts')
-rw-r--r-- | ext/node/polyfills/_fs/_fs_writeFile.ts | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/ext/node/polyfills/_fs/_fs_writeFile.ts b/ext/node/polyfills/_fs/_fs_writeFile.ts index 60b31897e..f0014c36d 100644 --- a/ext/node/polyfills/_fs/_fs_writeFile.ts +++ b/ext/node/polyfills/_fs/_fs_writeFile.ts @@ -20,7 +20,6 @@ import { denoErrorToNodeError, } from "ext:deno_node/internal/errors.ts"; import { - showStringCoercionDeprecation, validateStringAfterArrayBufferView, } from "ext:deno_node/internal/fs/utils.mjs"; import { promisify } from "ext:deno_node/internal/util.mjs"; @@ -32,8 +31,7 @@ interface Writer { export function writeFile( pathOrRid: string | number | URL, - // deno-lint-ignore ban-types - data: string | Uint8Array | Object, + data: string | Uint8Array, optOrCallback: Encodings | CallbackWithError | WriteFileOptions | undefined, callback?: CallbackWithError, ) { @@ -61,10 +59,7 @@ export function writeFile( if (!ArrayBuffer.isView(data)) { validateStringAfterArrayBufferView(data, "data"); - if (typeof data !== "string") { - showStringCoercionDeprecation(); - } - data = Buffer.from(String(data), encoding); + data = Buffer.from(data, encoding); } const isRid = typeof pathOrRid === "number"; @@ -101,15 +96,13 @@ export function writeFile( export const writeFilePromise = promisify(writeFile) as ( pathOrRid: string | number | URL, - // deno-lint-ignore ban-types - data: string | Uint8Array | Object, + data: string | Uint8Array, options?: Encodings | WriteFileOptions, ) => Promise<void>; export function writeFileSync( pathOrRid: string | number | URL, - // deno-lint-ignore ban-types - data: string | Uint8Array | Object, + data: string | Uint8Array, options?: Encodings | WriteFileOptions, ) { pathOrRid = pathOrRid instanceof URL ? pathFromURL(pathOrRid) : pathOrRid; @@ -127,10 +120,7 @@ export function writeFileSync( if (!ArrayBuffer.isView(data)) { validateStringAfterArrayBufferView(data, "data"); - if (typeof data !== "string") { - showStringCoercionDeprecation(); - } - data = Buffer.from(String(data), encoding); + data = Buffer.from(data, encoding); } const isRid = typeof pathOrRid === "number"; |