From 48c19d0bab5c1977e0d61a83d8e13c2bc26ef398 Mon Sep 17 00:00:00 2001 From: Asher Gomez Date: Thu, 25 Jan 2024 04:53:20 +1100 Subject: feat: deprecate `Deno.fstat()` and `Deno.fstatSync()` (#22068) For removal in Deno v2. --- ext/node/polyfills/_fs/_fs_fstat.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'ext/node/polyfills') diff --git a/ext/node/polyfills/_fs/_fs_fstat.ts b/ext/node/polyfills/_fs/_fs_fstat.ts index bc4cf3c42..fe97235bf 100644 --- a/ext/node/polyfills/_fs/_fs_fstat.ts +++ b/ext/node/polyfills/_fs/_fs_fstat.ts @@ -11,6 +11,7 @@ import { statOptions, Stats, } from "ext:deno_node/_fs/_fs_stat.ts"; +import { FsFile } from "ext:deno_fs/30_fs.js"; export function fstat(fd: number, callback: statCallback): void; export function fstat( @@ -40,7 +41,7 @@ export function fstat( if (!callback) throw new Error("No callback function supplied"); - Deno.fstat(fd).then( + new FsFile(fd).stat().then( (stat) => callback(null, CFISBIS(stat, options.bigint)), (err) => callback(err), ); @@ -59,6 +60,6 @@ export function fstatSync( fd: number, options?: statOptions, ): Stats | BigIntStats { - const origin = Deno.fstatSync(fd); + const origin = new FsFile(fd).statSync(); return CFISBIS(origin, options?.bigint || false); } -- cgit v1.2.3