Registry
Nnodejs avatar

nodejs/fs-access-mode-constants

Handle DEP0176 via transforming imports of `fs.F_OK`, `fs.R_OK`, `fs.W_OK`, `fs.X_OK` from the root `fs` module to `fs.constants`.

nodejs6,835 executions

  • transformation
  • migration
  • nodejs
Connect a repo
npx codemod @nodejs/fs-access-mode-constants

fs.F_OK, fs.R_OK, fs.W_OK, fs.X_OK DEP0176

Handle DEP0176 via transforming imports of fs.F_OK, fs.R_OK, fs.W_OK, fs.X_OK from the root fs module to fs.constants.

See DEP0176

Example

diff
  const fs = require('node:fs');

- fs.access('/path/to/file', fs.F_OK, callback);
+ fs.access('/path/to/file', fs.constants.F_OK, callback);
- fs.access('/path/to/file', fs.R_OK | fs.W_OK, callback);
+ fs.access('/path/to/file', fs.constants.R_OK | fs.constants.W_OK, callback);

Ready to evolve your codebase?

Build tailored, compiler-aware skills to assess, plan, and automate complex codebase changes.