@nodelib/fs.walk
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
@nodelib/fs.scandir | 2.1.5 | 6.43 kB | MIT | prod | |
fastq | 1.17.1 | 8.68 kB | ISC | prod |
@nodelib/fs.walk is a Javascript library designed for efficiently traversing a directory recursively. It offers useful built-in features such as returning efficient information on directories and files (such as their names, paths, directory entries, and stats), built-in directories/files and error filtering systems, and the ability to work safely with broken symbolic links. This library is perfect for developers wanting to handle complex directory and file management tasks in Node.js.
To use @nodelib/fs.walk, you first need to install the package using npm. You can do this from your project directory in the command line with npm install @nodelib/fs.walk
. Once installed, you can import it into your JavaScript or TypeScript file. Here are some usage examples:
To walk a directory asynchronously, use the .walk
method:
import * as fsWalk from '@nodelib/fs.walk';
fsWalk.walk('path-to-your-directory', (error, entries) => {
// Handle output or errors here
});
If you want to use a Readable Stream, use the .walkStream
method:
const stream = fsWalk.walkStream('path-to-your-directory');
And to walk a directory synchronously, use the .walkSync
method:
const entries = fsWalk.walkSync('path-to-your-directory');
The official documentation for @nodelib/fs.walk can be found on the readme file in the GitHub repository at https://github.com/nodelib/nodelib.git#master. These documents feature detailed instructions on the usage of the package, examples, and additional information on both its API and all possible options for deeper customization. This comprehensive documentation makes the package accessible for developers at all levels.