added node example

This commit is contained in:
AJ ONeal 2014-01-22 13:37:28 -07:00
parent 527d76dbd9
commit 50fe98e94d
4 changed files with 50 additions and 0 deletions

View File

@ -0,0 +1,20 @@
'use strict';
var fs = require('fs')
, path = require('path')
, dirpath = path.join(__dirname, 'testfiles')
;
fs.readdir(dirpath, function (err, nodes) {
nodes.forEach(function (node) {
var filepath = path.join(dirpath, node)
;
console.log(filepath);
fs.readFile(filepath, null, function (err, contents) {
console.log(node, contents.length);
});
});
console.log('All Done');
});

View File

@ -0,0 +1,22 @@
'use strict';
var fs = require('fs')
, forEachAsync = require('foreachasync').forEachAsync
, path = require('path')
, dirpath = path.join(__dirname, 'testfiles')
;
fs.readdir(dirpath, function (err, nodes) {
forEachAsync(nodes, function (next, node) {
var filepath = path.join(dirpath, node)
;
console.log(filepath);
fs.readFile(filepath, null, function (err, contents) {
console.log(node, contents.length);
next();
});
}).then(function () {
console.log('All Done!');
});
});

View File

@ -0,0 +1,8 @@
mkdir -p testfiles
touch ./testfiles/0b.bin
dd bs=1m count=1 if=/dev/zero of=./testfiles/1mb.bin
dd bs=1k count=64 if=/dev/zero of=./testfiles/64kb.bin
dd bs=1k count=96 if=/dev/zero of=./testfiles/96kb.bin
dd bs=1k count=1 if=/dev/zero of=./testfiles/1kb.bin
# this will copy one block which could be between 512b and 4k (or more)
dd bs=1b count=1 if=/dev/zero of=./testfiles/block.bin

0
examples/node/node_modules/.gitkeep generated vendored Normal file
View File