node/deps/npm/node_modules/fstream-npm/example/dir-tar.js

20 lines
548 B
JavaScript
Raw Normal View History

2012-07-14 02:40:38 +08:00
// this will show what ends up in the fstream-npm package
2015-03-27 18:56:05 +08:00
var P = require('fstream').DirReader
var tar = require('tar')
2012-07-14 02:40:38 +08:00
function f (entry) {
2015-03-27 18:56:05 +08:00
return entry.basename !== '.git'
2012-07-14 02:40:38 +08:00
}
2015-03-27 18:56:05 +08:00
new P({ path: './', type: 'Directory', Directory: true, filter: f })
.on('package', function (p) {
console.error('package', p)
2012-07-14 02:40:38 +08:00
})
2015-03-27 18:56:05 +08:00
.on('ignoreFile', function (e) {
console.error('ignoreFile', e)
2012-07-14 02:40:38 +08:00
})
2015-03-27 18:56:05 +08:00
.on('entry', function (e) {
2012-07-14 02:40:38 +08:00
console.error(e.constructor.name, e.path.substr(e.root.path.length + 1))
})
.pipe(tar.Pack())
.pipe(process.stdout)