Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
fs
✓ const fs = require('node-fs');
✗ import { fs } from 'node-fs';
This package exclusively uses CommonJS `require()` due to its age (Node.js 0.1.x era) and is incompatible with ESM `import` statements. The module exports an extended `fs` object.
createDirectory
✓ const fs = require('node-fs');
fs.createDirectory('./path/to/dir', 0o777, (err) => { /* ... */ });
✗ const { createDirectory } = require('node-fs');
The module extends the global `fs` object or returns an object with extended methods; individual functions are not typically destructured from the `require` call in this old CommonJS pattern. The `createDirectory` method has been superseded by `fs.mkdir(path, { recursive: true })` in modern Node.js.
remove
✓ const fs = require('node-fs');
fs.remove('./path/to/remove', (err) => { /* ... */ });
✗ require('node-fs').remove('./path');
This method for recursive deletion has been superseded by `fs.rm(path, { recursive: true, force: true })` in modern Node.js, with `fs.rmdir({ recursive: true })` being deprecated.
Demonstrates `node-fs`'s recursive directory creation and file copying features, then cleans up using modern Node.js `fs` methods.
const fs = require('node-fs');
const path = require('path');
const dirToCreate = path.join(__dirname, 'test-dir-legacy/sub-dir');
const fileToCopy = path.join(__dirname, 'test-file.txt');
const copiedFile = path.join(__dirname, 'test-dir-legacy/copied-file.txt');
// Create a dummy file for copying
require('fs').writeFileSync(fileToCopy, 'Hello from the past!');
console.log('Attempting to create directory recursively with node-fs...');
fs.createDirectory(dirToCreate, 0o777, true, (err) => {
if (err) {
console.error('Error creating directory:', err);
return;
}
console.log(`Directory created: ${dirToCreate}`);
console.log('Attempting to copy file with node-fs...');
fs.copy(fileToCopy, copiedFile, (err) => {
if (err) {
console.error('Error copying file:', err);
return;
}
console.log(`File copied from ${fileToCopy} to ${copiedFile}`);
// Clean up (using modern fs for robust cleanup)
console.log('Cleaning up...');
require('fs').unlinkSync(fileToCopy);
require('fs').unlinkSync(copiedFile);
require('fs').rmdirSync(path.dirname(dirToCreate), { recursive: true });
console.log('Cleanup complete.');
});
});
Debug
Known issues
breakingThis package is entirely incompatible with modern Node.js versions (v10+). Its functionalities are either natively implemented or have different, incompatible APIs in current Node.js releases. Attempting to use it will lead to runtime errors or unexpected behavior.fixDo not use this package. Migrate to native Node.js `fs` module functionalities. For recursive directory creation, use `fs.mkdir(path, { recursive: true })`. For recursive directory removal, use `fs.rm(path, { recursive: true, force: true })`. affects: >=1.0.0 (Node.js)
breakingThe package is abandoned, with its last commit in 2011. It receives no maintenance, security updates, or bug fixes, making it a significant security risk for any application still using it.fixImmediately remove this package from your dependencies and refactor code to use modern Node.js `fs` features or well-maintained third-party alternatives like `fs-extra` if additional utility functions are required.
affects: >=0.1.7
deprecatedMany functionalities provided by `node-fs`, such as recursive `mkdir` and `rmdir`, were eventually integrated into the native Node.js `fs` module with a different API signature and improved behavior. The `node-fs` API is effectively deprecated by native `fs` advancements.fixRewrite code to use Node.js's native `fs.mkdir(path, { recursive: true })` (since v10.12.0) and `fs.rm(path, { recursive: true })` (since v14.14.0 for `fs.rmdir` or preferred `fs.rm` for file/directory). affects: >=0.1.7
gotchaThe `fs.watchTree` method provided by this package is an inefficient and unreliable pattern for file system watching. Modern Node.js provides `fs.watch` which is more performant and robust, though still has platform-specific caveats.fixReplace `fs.watchTree` with `fs.watch` from the native Node.js `fs` module, or use a robust third-party watcher library that handles complexities (e.g., `chokidar`).
affects: >=0.1.7
gotchaThis package explicitly extends the Node.js `fs` module in a way that can lead to conflicts or unexpected behavior if other libraries also try to extend `fs` or if Node.js updates introduce new `fs` methods with the same names.fixAvoid using packages that monkey-patch or globally extend core Node.js modules. Prefer modular libraries that export their functionalities clearly or use native Node.js features.
affects: >=0.1.7
Errors
Common errors & fixes
TypeError: fs.createDirectory is not a function
Attempting to use `fs.createDirectory` (or other `node-fs` methods) after requiring the native Node.js 'fs' module, or after `node-fs` failed to load/patch 'fs'.
fixEnsure you are requiring `node-fs` correctly (`const fs = require('node-fs');`). However, the real fix is to stop using this abandoned package and migrate to native Node.js `fs` methods like `fs.mkdir(path, { recursive: true })`. Error: Cannot find module 'node-fs'
The `node-fs` package is not installed in `node_modules` or Node.js cannot resolve the module path.
fixInstall the package via `npm install node-fs`. However, it's strongly recommended NOT to use this abandoned package. Instead, refactor your code to use the native `fs` module.
Error: EACCES: permission denied, mkdir 'some/path'
The Node.js process does not have sufficient permissions to create a directory or file at the specified path, which is a common operating system permission error.
fixEnsure the Node.js process has write permissions to the target directory. On Linux/macOS, check file permissions with `ls -l` and use `chmod` if necessary. On Windows, verify folder security settings. This error is not specific to `node-fs` but common for any file system operation.
Audit
Dependencies
No dependency data recorded yet.