diff options
author | Asher Gomez <ashersaupingomez@gmail.com> | 2024-01-24 23:36:35 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-24 13:36:35 +0100 |
commit | aac0ad32bd589394316223f75e6f511331ff124c (patch) | |
tree | 695507e2303a3edc9920c4be2bbf06055581f8d2 /ext/node/polyfills/_fs | |
parent | c98ab51746776397502df089706c8bb6946882ff (diff) |
feat: deprecate `Deno.FsFile` constructor and `Deno.FsFile.rid` (#22072)
Diffstat (limited to 'ext/node/polyfills/_fs')
-rw-r--r-- | ext/node/polyfills/_fs/_fs_readFile.ts | 3 | ||||
-rw-r--r-- | ext/node/polyfills/_fs/_fs_writeFile.ts | 5 |
2 files changed, 5 insertions, 3 deletions
diff --git a/ext/node/polyfills/_fs/_fs_readFile.ts b/ext/node/polyfills/_fs/_fs_readFile.ts index 7e231d8ec..de1a2a30d 100644 --- a/ext/node/polyfills/_fs/_fs_readFile.ts +++ b/ext/node/polyfills/_fs/_fs_readFile.ts @@ -18,6 +18,7 @@ import { Encodings, TextEncodings, } from "ext:deno_node/_utils.ts"; +import { FsFile } from "ext:deno_fs/30_fs.js"; function maybeDecode(data: Uint8Array, encoding: TextEncodings): string; function maybeDecode( @@ -72,7 +73,7 @@ export function readFile( let p: Promise<Uint8Array>; if (path instanceof FileHandle) { - const fsFile = new Deno.FsFile(path.fd); + const fsFile = new FsFile(path.fd); p = readAll(fsFile); } else { p = Deno.readFile(path); diff --git a/ext/node/polyfills/_fs/_fs_writeFile.ts b/ext/node/polyfills/_fs/_fs_writeFile.ts index 47d5d38b4..40d368566 100644 --- a/ext/node/polyfills/_fs/_fs_writeFile.ts +++ b/ext/node/polyfills/_fs/_fs_writeFile.ts @@ -24,6 +24,7 @@ import { validateStringAfterArrayBufferView, } from "ext:deno_node/internal/fs/utils.mjs"; import { promisify } from "ext:deno_node/internal/util.mjs"; +import { FsFile } from "ext:deno_fs/30_fs.js"; interface Writer { write(p: Uint8Array): Promise<number>; @@ -73,7 +74,7 @@ export function writeFile( (async () => { try { file = isRid - ? new Deno.FsFile(pathOrRid as number) + ? new FsFile(pathOrRid as number) : await Deno.open(pathOrRid as string, openOptions); // ignore mode because it's not supported on windows @@ -138,7 +139,7 @@ export function writeFileSync( let error: Error | null = null; try { file = isRid - ? new Deno.FsFile(pathOrRid as number) + ? new FsFile(pathOrRid as number) : Deno.openSync(pathOrRid as string, openOptions); // ignore mode because it's not supported on windows |