diff options
Diffstat (limited to 'ext/node/polyfills/_fs')
-rw-r--r-- | ext/node/polyfills/_fs/_fs_read.ts | 4 | ||||
-rw-r--r-- | ext/node/polyfills/_fs/_fs_write.mjs | 6 | ||||
-rw-r--r-- | ext/node/polyfills/_fs/_fs_writeFile.ts | 20 |
3 files changed, 6 insertions, 24 deletions
diff --git a/ext/node/polyfills/_fs/_fs_read.ts b/ext/node/polyfills/_fs/_fs_read.ts index cf0c5e51d..e25f41e76 100644 --- a/ext/node/polyfills/_fs/_fs_read.ts +++ b/ext/node/polyfills/_fs/_fs_read.ts @@ -88,10 +88,6 @@ export function read( if ( !(opt.buffer instanceof Buffer) && !(opt.buffer instanceof Uint8Array) ) { - if (opt.buffer === null) { - // @ts-ignore: Intentionally create TypeError for passing test-fs-read.js#L87 - length = opt.buffer.byteLength; - } throw new ERR_INVALID_ARG_TYPE("buffer", [ "Buffer", "TypedArray", diff --git a/ext/node/polyfills/_fs/_fs_write.mjs b/ext/node/polyfills/_fs/_fs_write.mjs index aa23805bf..1ad6ac492 100644 --- a/ext/node/polyfills/_fs/_fs_write.mjs +++ b/ext/node/polyfills/_fs/_fs_write.mjs @@ -13,7 +13,6 @@ import * as io from "ext:deno_io/12_io.js"; import * as fs from "ext:deno_fs/30_fs.js"; import { getValidatedFd, - showStringCoercionDeprecation, validateOffsetLengthWrite, validateStringAfterArrayBufferView, } from "ext:deno_node/internal/fs/utils.mjs"; @@ -114,9 +113,6 @@ export function write(fd, buffer, offset, length, position, callback) { // `fs.write(fd, string[, position[, encoding]], callback)` validateStringAfterArrayBufferView(buffer, "buffer"); - if (typeof buffer !== "string") { - showStringCoercionDeprecation(); - } if (typeof position !== "function") { if (typeof offset === "function") { @@ -128,7 +124,7 @@ export function write(fd, buffer, offset, length, position, callback) { length = "utf-8"; } - const str = String(buffer); + const str = buffer; validateEncoding(str, length); callback = maybeCallback(position); buffer = Buffer.from(str, length); 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"; |