Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
read-dir-files
Advanced tools
Module for recursively (and non-recursively) reading all files in a directory.
npm install read-dir-files
var readDirFiles = require('read-dir-files');
readDirFiles.list('directory', function (err, filenames) {
if (err) return console.dir(err);
console.dir(filenames);
});
readDirFiles.read('directory', function (err, files) {
if (err) return console.dir(err);
console.dir(files);
});
Parameters:
dir
Directory to read files fromencoding
Files encoding. Optional.recursive
Recurse into subdirectories? Optional, default true
.callback
Callback. Optional.Asynchronously reads all files from dir
and returns them to the callback
in form:
{
dir: {
file0: <Buffer ...>,
file1: <Buffer ...>,
sub: {
file0: <Buffer ...>
}
}
}
If you pass it the encoding, instead of buffers you'll get strings.
Parameters:
dir
Directory to read filenames fromoptions
Files encoding. Optional.
options.recursive
Recurses subdirectories.options.normalize
Normalizes filenames.recursive
Recurse into subdirectories? Optional, default true
.callback
Callback. Optional.Asynchronously reads all filenames from dir
and returns them to the callback
in form:
[
'dir',
'file0',
'file1'
]
FAQs
Recursively read files from a directory
We found that read-dir-files demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.