Gathering detailed insights and metrics for totalist
Gathering detailed insights and metrics for totalist
A tiny (195B to 224B) utility to recursively list all (total) files in a directory
npm install totalist
Typescript
Module System
Min. Node Version
Node Version
NPM Version
99.3
Supply Chain
99.4
Quality
75.5
Maintenance
100
Vulnerability
100
License
JavaScript (100%)
Total Downloads
870,653,423
Last Day
562,642
Last Week
3,443,763
Last Month
29,012,729
Last Year
352,246,846
153 Stars
42 Commits
5 Forks
6 Watching
1 Branches
3 Contributors
Minified
Minified + Gzipped
Latest Version
3.0.1
Package Id
totalist@3.0.1
Unpacked Size
7.28 kB
Size
3.01 kB
File Count
9
NPM Version
8.19.2
Node Version
18.12.1
Publised On
03 Apr 2023
Cumulative downloads
Total Downloads
Last day
-16%
562,642
Compared to previous day
Last week
-45.6%
3,443,763
Compared to previous week
Last month
-8%
29,012,729
Compared to previous month
Last year
35.4%
352,246,846
Compared to previous year
A tiny (195B to 224B) utility to recursively list all (total) files in a directory
Traverse a directory recursively, running a function for every file found.
With this module, you easily apply custom logic to decide which file(s) to process without worrying about accidentally accessing a directory or making repeat fs.Stats
requests.
$ npm install --save totalist
There are two "versions" of totalist
available:
Node.js: >= 8.x
Size (gzip): 220 bytes
Availability: CommonJS, ES Module
This is the primary/default mode. It makes use of async
/await
and util.promisify
.
Node.js: >= 6.x
Size (gzip): 195 bytes
Availability: CommonJS, ES Module
This is the opt-in mode, ideal for scenarios where async
usage cannot be supported.
Selecting a Mode
1// import via npm module 2import { totalist } from 'totalist'; 3import { totalist } from 'totalist/sync';
Example Usage
1import { totalist } from 'totalist/sync'; 2 3const styles = new Set(); 4const scripts = new Set(); 5 6totalist('src', (name, abs, stats) => { 7 if (/\.js$/.test(name)) { 8 scripts.add(abs); 9 if (stats.size >= 100e3) { 10 console.warn(`[WARN] "${name}" might cause performance issues (${stats.size})`); 11 } 12 } else if (/\.css$/.test(name)) { 13 styles.add(abs); 14 } 15}); 16 17console.log([...scripts]); 18//=> [..., '/Users/lukeed/.../src/path/to/example.css', ...]
Returns: void
Important: The "async" usage must be
await
ed or included within a Promise chain.
Type: string
Required: true
The directory to traverse.
This may be a relative or an absolute path.
Note: Node.js will assume a relative path is meant to be resolved from the current location (
process.cwd()
).
Type: Function
Required: true
The callback function to run for every file.
The function receives three parameters:
Type: String
The path relative to the initial dir
value you provided.
Type: String
The absolute path of the file.
Type: fs.Stats
The fs.Stats
object for the file.
MIT © Luke Edwards
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 2/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-01-06
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More