Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
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. By default, filter is:
function (x) {
return x[0] !== '.'
}
Which basically just ignores .
files.
FAQs
Recursively read a directory
The npm package fs-readdir-recursive receives a total of 2,485,467 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.