my-node-fp is a utility library for Node.js, currently at version 0.10.3, offering a collection of simple functional programming utilities primarily focused on file system (fs) and path manipulation. It ships with TypeScript types, enhancing developer experience. The library provides both asynchronous and synchronous versions for many file system operations, such as checking file existence or directory status. Key differentiators include specialized path utilities like `replaceSepToPosix` and `win32DriveLetterUpdown`, which abstract away OS-specific path concerns. Given its pre-1.0 versioning, users should anticipate potential API changes in future releases, though it appears to be actively maintained based on its recent version number.
npm install my-node-fpVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic asynchronous file system checks and path manipulation utilities, including creating and cleaning up temporary files and directories, and transforming path separators.
For robust existence checks, consider using `fs.access` (or `fs.promises.access`) with `fs.constants.F_OK` or `fs.stat` (or `fs.promises.stat`) within a `try...catch` block directly, especially in new code or security-sensitive contexts.
Pin to exact versions (e.g., `"my-node-fp": "0.10.3"`) or use a lockfile (`package-lock.json`, `yarn.lock`) to prevent unexpected breaking changes during dependency updates. Always review release notes carefully when upgrading to newer pre-1.0 versions.
Prefer the asynchronous versions of functions (e.g., `isDirectory` over `isDirectorySync`) for all I/O operations in performance-sensitive applications, especially in Node.js server contexts. Only use synchronous variants for startup scripts, CLI tools, or non-critical blocking operations where performance is not a primary concern.
Ensure you are using named imports from the correct subpath for the specific utility category, e.g., `import { exists } from 'my-node-fp/fs';` for file system utilities or `import { basenames } from 'my-node-fp/path';` for path utilities.Verify that your Node.js process has the necessary read/write/execute permissions for the target file or directory. If encountering this after an existence check, be aware of the race conditions inherent to `fs.exists` (and `my-node-fp`'s mirror thereof); prefer using `fs.promises.access` or handling errors from operations like `fs.promises.stat` or `fs.promises.mkdir` directly.
No dependency data recorded yet.