fs-jetpack provides a more convenient and opinionated API for common file system manipulations, designed as an alternative to Node.js's native `fs` module and `fs-extra`. It is particularly well-suited for scripting, tooling, and build pipelines. Currently at stable version 5.1.0, the library has an active development pace with several minor and major releases in recent years, indicating ongoing maintenance and feature additions. Key differentiators include the ability to create multiple independent Current Working Directories (CWDs) for an object-oriented approach to file operations, first-class support for JSON serialization/deserialization, automatic handling of `ENOENT` errors (creating parent directories as needed and returning `undefined` for non-existent reads), and a consistent `method()` (synchronous) and `methodAsync()` (promise-based asynchronous) naming convention, which deviates from standard Node.js patterns but aims for clarity within the library.
npm install fs-jetpackVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic synchronous and asynchronous file writes and reads, JSON handling, directory creation, and the chaining API using a temporary directory.
Upgrade your Node.js environment to version 14 or newer, or pin fs-jetpack to a version older than 5.0.0 (e.g., `^4.0.0`).
Review any code that relies on the exact output of `inspect()` with the `times` option and adjust for the presence of `birthTime`.
Always use `methodAsync()` when expecting a Promise and asynchronous behavior. Use `method()` for immediate, synchronous results.
Thoroughly test file removal operations when upgrading to v5.0.0 or later, especially in environments with complex file structures or restrictive permissions.
If you need asynchronous behavior (returning a Promise), use `jetpack.readAsync()`. If you need synchronous behavior, use `jetpack.read()`.
fs-jetpack provides a default export. Use `import jetpack from 'fs-jetpack';` for ESM, or `const jetpack = require('fs-jetpack');` for CommonJS.Upgrade your Node.js installation to version 14 or a newer Long Term Support (LTS) release. Alternatively, use an older version of fs-jetpack (e.g., `npm install fs-jetpack@^4.0.0`).
No dependency data recorded yet.