totalist
Advanced tools
Comparing version 0.0.0 to 1.0.0
@@ -1,2 +0,2 @@ | ||
const { join } = require('path'); | ||
const { join, resolve } = require('path'); | ||
const { readdir, stat } = require('fs'); | ||
@@ -9,5 +9,6 @@ const { promisify } = require('util'); | ||
module.exports = async function list(dir, callback, pre='') { | ||
let abs, stats; | ||
dir = resolve('.', dir); | ||
let arr = await toRead(dir); | ||
for (let str of arr) { | ||
let str, abs, stats; | ||
for (str of arr) { | ||
abs = join(dir, str); | ||
@@ -14,0 +15,0 @@ stats = await toStats(abs); |
{ | ||
"name": "totalist", | ||
"version": "0.0.0", | ||
"version": "1.0.0", | ||
"repository": "lukeed/totalist", | ||
"description": "A tiny (181B to 195B) utility to recursively list all (total) files in a directory", | ||
"description": "A tiny (195B to 211B) utility to recursively list all (total) files in a directory", | ||
"module": "dist/index.mjs", | ||
@@ -23,5 +23,11 @@ "main": "dist/index.js", | ||
}, | ||
"keywords": [ | ||
"list", | ||
"recursive", | ||
"files", | ||
"glob", | ||
"tree" | ||
], | ||
"scripts": { | ||
"build": "node bin", | ||
"pretest": "npm run build", | ||
"test": "tape -r esm test/*.js | tap-spec" | ||
@@ -28,0 +34,0 @@ }, |
# 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) | ||
> A tiny (181B to 195B) utility to recursively list all (total) files in a directory | ||
> A tiny (195B to 211B) utility to recursively list all (total) files in a directory | ||
@@ -22,3 +22,3 @@ Traverse a directory recursively, running a function for **every file** found. | ||
> **Node.js:** >= 8.x<br> | ||
> **Size (gzip):** 195 bytes<br> | ||
> **Size (gzip):** 211 bytes<br> | ||
> **Availability:** [CommonJS](https://unpkg.com/totalist/dist/index.js), [ES Module](https://unpkg.com/totalist/dist/index.mjs) | ||
@@ -30,3 +30,3 @@ | ||
> **Node.js:** >= 6.x<br> | ||
> **Size (gzip):** 181 bytes<br> | ||
> **Size (gzip):** 195 bytes<br> | ||
> **Availability:** [CommonJS](https://unpkg.com/totalist/sync/index.js), [ES Module](https://unpkg.com/totalist/sync/index.mjs) | ||
@@ -59,8 +59,11 @@ | ||
if (stats.size >= 100e3) { | ||
console.warn(`[WARN] "${name}" might cause performance issues (${stats.size})`;) | ||
console.warn(`[WARN] "${name}" might cause performance issues (${stats.size})`); | ||
} | ||
} else if (/\.css$/.test(name)) { | ||
styles.add(abs); | ||
styles.add(abs); | ||
} | ||
}); | ||
console.log([...scripts]); | ||
//=> [..., '/Users/lukeed/.../src/path/to/example.css', ...] | ||
``` | ||
@@ -67,0 +70,0 @@ |
@@ -1,7 +0,8 @@ | ||
const { join } = require('path'); | ||
const { join, resolve } = require('path'); | ||
const { readdirSync, statSync } = require('fs'); | ||
module.exports = function list(dir, callback, pre='') { | ||
dir = resolve('.', dir); | ||
let arr = readdirSync(dir); | ||
let i=0, abs, stats; | ||
let arr = readdirSync(dir); | ||
for (; i < arr.length; i++) { | ||
@@ -8,0 +9,0 @@ abs = join(dir, arr[i]); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
7044
74
0
110