twalker

0.0.6 • Public • Published

twalker Build Status

List files grouped by type, asynchronously. twalker is based in walk, a nodejs walk implementation.

Install

$ npm install --save twalker

Usage

var twalker = require('twalker');
var walk = twalker('/home/me', {
  Images: ['jpg', 'png', 'gif', 'icon'],
  Documents: ['doc', 'docx', 'txt', 'pdf', 'xls', 'xlsx']
});
 
walk.on('file', function (fileStats) {
  //do something: calculate disk usage, list file names by type, etc.
  //fileStats.metaType: 'Images', 'Documents'
});
 
walk.on('end', function () {
  console.log('Done.')
})

If the types parameter is null, it uses a default type definition, that can be accessed by twalker.metaTypes property.

API

twalker(baseDir, types)

baseDir

Required
Type: string

The base directory where it walks from.

types

Optional
Type: JSON

List of files extensions grouped by type.

License

MIT © Danilo Sampaio

Package Sidebar

Install

npm i twalker

Weekly Downloads

4

Version

0.0.6

License

MIT

Last publish

Collaborators

  • danilosampaio