Skip to content

Commit 60f0cb8

Browse files
committed
async with limit
1 parent 0ed7e01 commit 60f0cb8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

bin/find.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ const lib = require('../index.js');
88
const dir = './tmp/';
99

1010
fs.readdir(dir).then(files => {
11-
// files.map(fileName => {
12-
async.eachSeries(files, (fileName, callback) => {
11+
const tt0 = Date.now();
12+
async.eachLimit(files, 2, (fileName, callback) => {
1313
let len = 0;
1414
let chunks = 0;
1515
let goodChunks = 0;
@@ -35,5 +35,7 @@ fs.readdir(dir).then(files => {
3535
);
3636
callback();
3737
});
38+
}, () => {
39+
console.log('Total time: ' + (Date.now() - tt0) / 1000 + 's');
3840
});
3941
});

0 commit comments

Comments
 (0)