
Security News
/Research
Wallet-Draining npm Package Impersonates Nodemailer to Hijack Crypto Transactions
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
@aboviq/readdir-recursive
Advanced tools
Customizeable async recursive fs.readdir with no dependencies and sane defaults
Customizeable async recursive fs.readdir with no dependencies and sane defaults
node_modules
by defaultInstall @aboviq/readdir-recursive
using npm:
npm install @aboviq/readdir-recursive
const readdirRecursive = require('@aboviq/readdir-recursive');
const files = await readdirRecursive('a/path');
/*
[
"/full-path/a/path/filename.ext",
"/full-path/a/path/nested/folders/another.ext",
...
]
*/
const files = readdirRecursive.sync('a/path');
/*
[
"/full-path/a/path/filename.ext",
"/full-path/a/path/nested/folders/another.ext",
...
]
*/
readdirRecursive(dir, options)
Name | Type | Description |
---|---|---|
dir | String | The folder to read files recursively in, either relative to cwd or an absolute path |
options | Object | Options for filtering, recursion and transformation |
Returns: Promise<Array>
, all found files transformed according to the transformer and that has not been filtered out
readdirRecursive.sync(dir, options)
Name | Type | Description |
---|---|---|
dir | String | The folder to read files recursively in, either relative to cwd or an absolute path |
options | Object | Options for filtering, recursion and transformation |
Returns: Array
, all found files transformed according to the transformer and that has not been filtered out
Note: all function options can be asynchronous (return promises) when using the async version of readdirRecursive
, but not with the sync version.
options.filter
Type: Function
Signature: filter :: Object -> Boolean
Default: () => true
The filter
option is used to decide if a file should be included in the resulting array of files or not. A file is included if the filter function returns a truthy value.
The Object
passed to the filter
function has the following properties:
Name | Type | Description |
---|---|---|
file | String | The file name, e.g. "file.txt" |
path | String | The full path to the file, e.g. "/your/folder/sub-folder/file.txt" |
stats | Stats | A stats object providing information about the file |
options.transform
Type: Function
Signature: transform :: Object -> String
Default: a function returing the full path of each file
The transform
option is used to transform file information into something useful. Every file that passes the filter function will be transformed before being included in the resulting array.
The Object
passed to the transform
function has the following properties:
Name | Type | Description |
---|---|---|
file | String | The file name, e.g. "file.txt" |
path | String | The full path to the file, e.g. "/your/folder/sub-folder/file.txt" |
stats | Stats | A stats object providing information about the file |
options.recurse
Type: Function
Signature: recurse :: Object -> Boolean
Default: a function which won't recurse node_modules
The recurse
option is used to decide if a folder should be recursed into or not. A folder is recursed if the recurse function returns a truthy value.
The Object
passed to the recurse
function has the following properties:
Name | Type | Description |
---|---|---|
dir | String | The folder name, e.g. "src" |
path | String | The full path to the folder, e.g. "/your/folder/sub-folder" |
stats | Stats | A stats object providing information about the folder |
See Contribution Guidelines and our Code Of Conduct.
MIT © Aboviq AB
FAQs
Customizeable async recursive fs.readdir with no dependencies and sane defaults
The npm package @aboviq/readdir-recursive receives a total of 7 weekly downloads. As such, @aboviq/readdir-recursive popularity was classified as not popular.
We found that @aboviq/readdir-recursive demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 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
/Research
Malicious npm package impersonates Nodemailer and drains wallets by hijacking crypto transactions across multiple blockchains.
Security News
This episode explores the hard problem of reachability analysis, from static analysis limits to handling dynamic languages and massive dependency trees.
Security News
/Research
Malicious Nx npm versions stole secrets and wallet info using AI CLI tools; Socket’s AI scanner detected the supply chain attack and flagged the malware.