{"_id":"totalist","_rev":"2974257","name":"totalist","description":"A tiny (195B to 220B) utility to recursively list all (total) files in a directory","dist-tags":{"latest":"3.0.1"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"time":{"modified":"2023-06-15T08:25:05.000Z","created":"2019-10-22T00:33:00.036Z","3.0.1":"2023-04-03T18:36:39.508Z","3.0.0":"2022-01-17T20:09:58.038Z","2.0.0":"2020-08-19T06:49:03.874Z","1.1.0":"2020-06-20T23:53:39.218Z","1.0.1":"2019-10-24T03:28:02.566Z","1.0.0":"2019-10-22T04:20:34.416Z","0.0.0":"2019-10-22T00:33:00.036Z"},"users":{},"author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"repository":{"type":"git","url":"git+https://github.com/lukeed/totalist.git"},"versions":{"3.0.1":{"name":"totalist","version":"3.0.1","repository":{"type":"git","url":"git+https://github.com/lukeed/totalist.git"},"description":"A tiny (195B to 220B) utility to recursively list all (total) files in a directory","module":"dist/index.mjs","main":"dist/index.js","types":"index.d.ts","exports":{".":{"types":"./index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./sync":{"types":"./sync/index.d.ts","import":"./sync/index.mjs","require":"./sync/index.js"}},"license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"engines":{"node":">=6"},"keywords":["list","recursive","files","glob","tree"],"scripts":{"build":"bundt","test":"uvu -r esm test -i fixtures"},"modes":{"sync":"src/sync.js","default":"src/async.js"},"devDependencies":{"bundt":"1.1.1","esm":"3.2.25","uvu":"0.3.3"},"gitHead":"4b071d3e54d466a4059de89006c752da782c8b02","bugs":{"url":"https://github.com/lukeed/totalist/issues"},"homepage":"https://github.com/lukeed/totalist#readme","_id":"totalist@3.0.1","_nodeVersion":"18.12.1","_npmVersion":"8.19.2","dist":{"shasum":"ba3a3d600c915b1a97872348f79c127475f6acf8","size":3082,"noattachment":false,"key":"/totalist/-/totalist-3.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/totalist/download/totalist-3.0.1.tgz"},"_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"directories":{},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/totalist_3.0.1_1680546999345_0.3553415499300503"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-04-03T18:36:39.508Z","publish_time":1680546999508,"_cnpm_publish_time":1680546999508},"3.0.0":{"name":"totalist","version":"3.0.0","repository":{"type":"git","url":"git+https://github.com/lukeed/totalist.git"},"description":"A tiny (195B to 220B) utility to recursively list all (total) files in a directory","module":"dist/index.mjs","main":"dist/index.js","types":"index.d.ts","exports":{".":{"import":"./dist/index.mjs","require":"./dist/index.js"},"./sync":{"import":"./sync/index.mjs","require":"./sync/index.js"}},"license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"engines":{"node":">=6"},"keywords":["list","recursive","files","glob","tree"],"scripts":{"build":"bundt","test":"uvu -r esm test -i fixtures"},"modes":{"sync":"src/sync.js","default":"src/async.js"},"devDependencies":{"bundt":"1.1.1","esm":"3.2.25","uvu":"0.3.3"},"gitHead":"1a82bf3dfb9e25bf4e0341d9be10218f0f7194d6","bugs":{"url":"https://github.com/lukeed/totalist/issues"},"homepage":"https://github.com/lukeed/totalist#readme","_id":"totalist@3.0.0","_nodeVersion":"16.13.0","_npmVersion":"8.1.0","dist":{"shasum":"4ef9c58c5f095255cdc3ff2a0a55091c57a3a1bd","size":3073,"noattachment":false,"key":"/totalist/-/totalist-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/totalist/download/totalist-3.0.0.tgz"},"_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"directories":{},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/totalist_3.0.0_1642450197882_0.017623012021366957"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-01-17T20:10:04.275Z","publish_time":1642450198038,"_cnpm_publish_time":1642450198038},"2.0.0":{"name":"totalist","version":"2.0.0","repository":{"type":"git","url":"git+https://github.com/lukeed/totalist.git"},"description":"A tiny (195B to 220B) utility to recursively list all (total) files in a directory","module":"dist/index.mjs","main":"dist/index.js","types":"index.d.ts","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"engines":{"node":">=6"},"keywords":["list","recursive","files","glob","tree"],"scripts":{"build":"bundt","test":"uvu -r esm test -i fixtures"},"modes":{"sync":"src/sync.js","default":"src/async.js"},"devDependencies":{"bundt":"1.1.1","esm":"3.2.25","uvu":"0.3.3"},"gitHead":"44379974e535afe9c38e8d643dd64c59101a14b9","bugs":{"url":"https://github.com/lukeed/totalist/issues"},"homepage":"https://github.com/lukeed/totalist#readme","_id":"totalist@2.0.0","_nodeVersion":"12.18.3","_npmVersion":"6.14.6","dist":{"shasum":"db6f1e19c0fa63e71339bbb8fba89653c18c7eec","size":3062,"noattachment":false,"key":"/totalist/-/totalist-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/totalist/download/totalist-2.0.0.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/totalist_2.0.0_1597819743725_0.23484147911810394"},"_hasShrinkwrap":false,"publish_time":1597819743874,"_cnpm_publish_time":1597819743874},"1.1.0":{"name":"totalist","version":"1.1.0","repository":{"type":"git","url":"git+https://github.com/lukeed/totalist.git"},"description":"A tiny (195B to 224B) utility to recursively list all (total) files in a directory","module":"dist/index.mjs","main":"dist/index.js","types":"index.d.ts","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"engines":{"node":">=6"},"keywords":["list","recursive","files","glob","tree"],"scripts":{"build":"bundt","postbuild":"cp sync.d.ts sync/index.d.ts","test":"uvu -r esm test -i fixtures"},"modes":{"sync":"src/sync.js","default":"src/async.js"},"devDependencies":{"bundt":"1.0.1","esm":"3.2.25","premove":"1.0.0","uvu":"0.0.13"},"gitHead":"193f6476c04804dba24f02a6e1fa0f509b205be9","bugs":{"url":"https://github.com/lukeed/totalist/issues"},"homepage":"https://github.com/lukeed/totalist#readme","_id":"totalist@1.1.0","_npmVersion":"6.4.1","_nodeVersion":"10.13.0","_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"dist":{"shasum":"a4d65a3e546517701e3e5c37a47a70ac97fe56df","size":3132,"noattachment":false,"key":"/totalist/-/totalist-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/totalist/download/totalist-1.1.0.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/totalist_1.1.0_1592697219074_0.25547897670516684"},"_hasShrinkwrap":false,"publish_time":1592697219218,"_cnpm_publish_time":1592697219218},"1.0.1":{"name":"totalist","version":"1.0.1","repository":{"type":"git","url":"git+https://github.com/lukeed/totalist.git"},"description":"A tiny (195B to 224B) utility to recursively list all (total) files in a directory","module":"dist/index.mjs","main":"dist/index.js","types":"index.d.ts","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"engines":{"node":">=6"},"keywords":["list","recursive","files","glob","tree"],"scripts":{"build":"node bin","test":"tape -r esm test/*.js | tap-spec"},"devDependencies":{"bundt":"0.4.0","esm":"3.2.25","premove":"1.0.0","tap-spec":"5.0.0","tape":"4.11.0"},"gitHead":"bb6fa5eee5b87fd025eae38b108afb899fd7f809","bugs":{"url":"https://github.com/lukeed/totalist/issues"},"homepage":"https://github.com/lukeed/totalist#readme","_id":"totalist@1.0.1","_npmVersion":"6.4.1","_nodeVersion":"10.13.0","_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"dist":{"shasum":"c62ad01d773c1a0c721e18d385767c14712a82da","size":3060,"noattachment":false,"key":"/totalist/-/totalist-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/totalist/download/totalist-1.0.1.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/totalist_1.0.1_1571887682401_0.3890575452935492"},"_hasShrinkwrap":false,"publish_time":1571887682566,"_cnpm_publish_time":1571887682566},"1.0.0":{"name":"totalist","version":"1.0.0","repository":{"type":"git","url":"git+https://github.com/lukeed/totalist.git"},"description":"A tiny (195B to 211B) utility to recursively list all (total) files in a directory","module":"dist/index.mjs","main":"dist/index.js","types":"index.d.ts","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"engines":{"node":">=6"},"keywords":["list","recursive","files","glob","tree"],"scripts":{"build":"node bin","test":"tape -r esm test/*.js | tap-spec"},"devDependencies":{"bundt":"0.4.0","esm":"3.2.25","premove":"1.0.0","tap-spec":"5.0.0","tape":"4.11.0"},"gitHead":"6e620cfa691a76cc7ac6ef7fc3e49136d7f6f874","bugs":{"url":"https://github.com/lukeed/totalist/issues"},"homepage":"https://github.com/lukeed/totalist#readme","_id":"totalist@1.0.0","_npmVersion":"6.4.1","_nodeVersion":"10.13.0","_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"dist":{"shasum":"a8d5c222af3bb7cfc387c850261b4367e01cd74d","size":3022,"noattachment":false,"key":"/totalist/-/totalist-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/totalist/download/totalist-1.0.0.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/totalist_1.0.0_1571718034198_0.7194270173873631"},"_hasShrinkwrap":false,"publish_time":1571718034416,"_cnpm_publish_time":1571718034416},"0.0.0":{"name":"totalist","version":"0.0.0","repository":{"type":"git","url":"git+https://github.com/lukeed/totalist.git"},"description":"A tiny (181B to 195B) utility to recursively list all (total) files in a directory","module":"dist/index.mjs","main":"dist/index.js","types":"index.d.ts","license":"MIT","author":{"name":"Luke Edwards","email":"luke.edwards05@gmail.com","url":"https://lukeed.com"},"engines":{"node":">=6"},"scripts":{"build":"node bin","pretest":"npm run build","test":"tape -r esm test/*.js | tap-spec"},"devDependencies":{"bundt":"0.4.0","esm":"3.2.25","premove":"1.0.0","tap-spec":"5.0.0","tape":"4.11.0"},"gitHead":"c8d725411f03e329085fd100522dd6abe3e4ea0b","bugs":{"url":"https://github.com/lukeed/totalist/issues"},"homepage":"https://github.com/lukeed/totalist#readme","_id":"totalist@0.0.0","_npmVersion":"6.4.1","_nodeVersion":"10.13.0","_npmUser":{"name":"lukeed","email":"luke@lukeed.com"},"dist":{"shasum":"ee2214c2135168083daf0d599538d3dd5b75f93d","size":2896,"noattachment":false,"key":"/totalist/-/totalist-0.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/totalist/download/totalist-0.0.0.tgz"},"maintainers":[{"name":"lukeed","email":"luke@lukeed.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/totalist_0.0.0_1571704379901_0.727980550891538"},"_hasShrinkwrap":false,"publish_time":1571704380036,"_cnpm_publish_time":1571704380036}},"readme":"# totalist [![build status](https://badgen.now.sh/github/status/lukeed/totalist)](https://github.com/lukeed/totalist/actions) [![codecov](https://badgen.now.sh/codecov/c/github/lukeed/totalist)](https://codecov.io/gh/lukeed/totalist)\n\n> A tiny (195B to 224B) utility to recursively list all (total) files in a directory\n\nTraverse a directory recursively, running a function for **every file** found.\n\nWith 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.\n\n## Install\n\n```\n$ npm install --save totalist\n```\n\n\n## Modes\n\nThere are two \"versions\" of `totalist` available:\n\n#### \"async\"\n> **Node.js:** >= 8.x<br>\n> **Size (gzip):** 220 bytes<br>\n> **Availability:** [CommonJS](https://unpkg.com/totalist/dist/index.js), [ES Module](https://unpkg.com/totalist/dist/index.mjs)\n\nThis is the primary/default mode. It makes use of `async`/`await` and [`util.promisify`](https://nodejs.org/api/util.html#util_util_promisify_original).\n\n#### \"sync\"\n> **Node.js:** >= 6.x<br>\n> **Size (gzip):** 195 bytes<br>\n> **Availability:** [CommonJS](https://unpkg.com/totalist/sync/index.js), [ES Module](https://unpkg.com/totalist/sync/index.mjs)\n\nThis is the opt-in mode, ideal for scenarios where `async` usage cannot be supported.\n\n\n## Usage\n\n***Selecting a Mode***\n\n```js\n// import via npm module\nimport { totalist } from 'totalist';\nimport { totalist } from 'totalist/sync';\n```\n\n***Example Usage***\n\n```js\nimport { totalist } from 'totalist/sync';\n\nconst styles = new Set();\nconst scripts = new Set();\n\ntotalist('src', (name, abs, stats) => {\n  if (/\\.js$/.test(name)) {\n    scripts.add(abs);\n    if (stats.size >= 100e3) {\n      console.warn(`[WARN] \"${name}\" might cause performance issues (${stats.size})`);\n    }\n  } else if (/\\.css$/.test(name)) {\n    styles.add(abs);\n  }\n});\n\nconsole.log([...scripts]);\n//=> [..., '/Users/lukeed/.../src/path/to/example.css', ...]\n```\n\n\n## API\n\n### totalist(dir, callback)\nReturns: `void`\n\n> **Important:** The \"async\" usage must be `await`ed or included within a Promise chain.\n\n#### dir\nType: `string`<br>\nRequired: `true`\n\nThe directory to traverse.\n\nThis may be a relative _or_ an absolute path.\n\n> **Note**: Node.js will assume a relative path is meant to be resolved from the current location (`process.cwd()`).\n\n#### callback\nType: `Function`<br>\nRequired: `true`\n\nThe callback function to run for _every_ file.\n\nThe function receives three parameters:\n\n##### relPath\nType: `String`<br>\nThe path _relative to_ the initial `dir` value you provided.\n\n##### absPath\nType: `String`<br>\nThe absolute path of the file.\n\n##### stats\nType: `fs.Stats`<br>\nThe [`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats) object for the file.\n\n\n## License\n\nMIT © [Luke Edwards](https://lukeed.com)\n","_attachments":{},"homepage":"https://github.com/lukeed/totalist#readme","bugs":{"url":"https://github.com/lukeed/totalist/issues"},"license":"MIT"}