isaacs / node-graceful-fs

fs with incremental backoff on EMFILE
ISC License
1.27k stars 147 forks source link

Patch fs.Stats() #251

Open kashav opened 3 weeks ago

kashav commented 3 weeks ago

The fs.Stats constructor function is marked as deprecated as of Node v22.0.0 - https://nodejs.org/api/deprecations.html#DEP0180:

Calling fs.Stats class directly with Stats() or new Stats() is deprecated due to being internals, not intended for public use.

It's used all over including for example in gulp/vinyl-fs: https://github.com/gulpjs/vinyl-fs/issues/356, and it's not clear to me what an alternative could be. Would it make sense to patch it in this library?

> fs = require("node:fs")
> new fs.Stats()
Stats {
  dev: undefined,
  mode: undefined,
  nlink: undefined,
  uid: undefined,
  gid: undefined,
  rdev: undefined,
  blksize: undefined,
  ino: undefined,
  size: undefined,
  blocks: undefined,
  atimeMs: undefined,
  mtimeMs: undefined,
  ctimeMs: undefined,
  birthtimeMs: undefined
}