
Research
Security News
The Growing Risk of Malicious Browser Extensions
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
@epdoc/fsutil
Advanced tools
Async File System utilities for Node.js
@epdoc/fsutil is a powerful and flexible Node.js package that provides asynchronous file system utilities. It offers an intuitive API for working with files and directories, including operations like reading, writing, copying, and moving files, as well as directory management and file type detection.
To install @epdoc/fsutil, run the following command in your project directory:
npm install @epdoc/fsutil
Here's an example of how to use @epdoc/fsutil to read a JSON file:
const { fsitem } = require('@epdoc/fsutil');
// Check if a directory exists
if (await fsitem('~/.ssh').isDir()) {
console.log('SSH directory exists');
}
// Read a JSON file
const config = await fsitem('config.json').readJson();
// Write to a file
await fsitem('output.txt').write('Hello, World!');
// Copy a file safely
await fsitem('source.txt').safeCopy('destination.txt');
FSItem
: Core class for file system operations
isFile()
, isDir()
, getStats()
)readAsBuffer()
, readAsString()
, readJson()
)write()
, safeCopy()
, backup()
)getChildren()
, getFiles()
, getFolders()
)sortChildren()
, sortFiles()
, sortFilesBySize()
)FSBytes
: Class for working with file bytes and detecting file types
getType()
, getCategory()
)FSStats
: Extended class for file statistics
fs.Stats
fsitem(path: string): FSItem
: Creates an FSItem instance for the given pathfsbytes(buffer: Buffer): FSBytes
: Creates an FSBytes instance for the given bufferFileType
: Enum for various file typesFileCategory
: Enum for file categoriesFSSortOpts
: Interface for sorting optionsSafeCopyOpts
: Interface for safe copy optionsFileConflictStrategy
: Type for handling file conflictsFor detailed API documentation and usage examples, please refer to the JSDoc comments in the source code of each class and function.
To set up the development environment:
git clone https://github.com/epdoc/fsutil.git
cd fsutil
npm install
npm run build
npm test
To check for the latest version of dependencies, use npm-check -u
(must be installed globally).
[Insert license information here]
Contributions are not whole heartedly welcome yet, as I am still developing this mostly for personal use! Please feel free to submit a Pull Request.
If you encounter any problems or have any questions, please open an issue on the GitHub repository.
FAQs
File system path wrapper
We found that @epdoc/fsutil demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover how browser extensions in trusted stores are used to hijack sessions, redirect traffic, and manipulate user behavior.
Research
Security News
An in-depth analysis of credential stealers, crypto drainers, cryptojackers, and clipboard hijackers abusing open source package registries to compromise Web3 development environments.
Security News
pnpm 10.12.1 introduces a global virtual store for faster installs and new options for managing dependencies with version catalogs.