Bug:Fix file validation issue
[vnfsdk/refrepo.git] / vnfmarket / src / main / webapp / vnfmarket / node_modules / readdirp / examples / stream-api-pipe.js
1 var readdirp =  require('..')
2   , path = require('path')
3   , through = require('through2')
4
5 // print out all JavaScript files along with their size
6 readdirp({ root: path.join(__dirname), fileFilter: '*.js' })
7   .on('warn', function (err) { console.error('non-fatal error', err); })
8   .on('error', function (err) { console.error('fatal error', err); })
9   .pipe(through.obj(function (entry, _, cb) { 
10     this.push({ path: entry.path, size: entry.stat.size });
11     cb();
12   }))
13   .pipe(through.obj(
14     function (res, _, cb) { 
15       this.push(JSON.stringify(res) + '\n');
16       cb();
17     })
18   )
19   .pipe(process.stdout);