Security News
Internet Archive Hacked, 31 Million Record Compromised
The Internet Archive's "Wayback Machine" has been hacked and defaced, with 31 millions records compromised.
fs-readdir-recursive
Advanced tools
The fs-readdir-recursive npm package is a utility for reading directories recursively. It allows you to list all files within a directory and its subdirectories, making it useful for tasks that require directory traversal.
Read all files in a directory recursively
This feature allows you to read all files in a specified directory and its subdirectories. The code sample demonstrates how to use the package to list all files within 'path/to/directory'.
const read = require('fs-readdir-recursive');
const files = read('path/to/directory');
console.log(files);
Filter files based on a condition
This feature allows you to filter the files based on a condition. The code sample demonstrates how to list only JavaScript files within 'path/to/directory' and its subdirectories.
const read = require('fs-readdir-recursive');
const files = read('path/to/directory', (name) => name.endsWith('.js'));
console.log(files);
The recursive-readdir package provides similar functionality to fs-readdir-recursive, allowing you to read directories recursively. It also supports filtering files based on conditions and excluding specific files or directories.
The klaw package is another alternative for recursive directory traversal. It provides a stream-based API for reading directories and supports filtering and excluding files or directories. It is more flexible and powerful compared to fs-readdir-recursive.
The readdirp package offers recursive directory reading with additional features like filtering, streaming, and handling large directories efficiently. It is more feature-rich and performant compared to fs-readdir-recursive.
Read a directory recursively.
npm install fs-readdir-recursive
var read = require('fs-readdir-recursive')
read(__dirname) === [
'test/test.js',
'index.js',
'LICENSE',
'package.json',
'README.md'
]
root
is the directory you wish to scan. filter
is an optional filter for the files with three params(name, index, dir). By default, filter is:
function (name) {
return name[0] !== '.'
}
Which basically just ignores .
files.
FAQs
Recursively read a directory
The npm package fs-readdir-recursive receives a total of 2,469,459 weekly downloads. As such, fs-readdir-recursive popularity was classified as popular.
We found that fs-readdir-recursive demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 6 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.
Security News
The Internet Archive's "Wayback Machine" has been hacked and defaced, with 31 millions records compromised.
Security News
TC39 is meeting in Tokyo this week and they have approved nearly a dozen proposals to advance to the next stages.
Security News
Our threat research team breaks down two malicious npm packages designed to exploit developer trust, steal your data, and destroy data on your machine.