fs-of-type
wraps `async.filter` to find items of a particular type in a directory
Last updated 4 years ago by recursion_excursion .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install fs-of-type 
SYNC missed versions from official npm registry.

fs-of-type Build Status

wraps async.filter to find items of a particular type in a directory

Install

npm install --save fs-of-type

Usage

const ofType = require('fs-of-type');
const pathToContents = path.join(process.env.HOME, 'documents');

ofType(pathToContents, 'file', (err, files) => {

  // => `files` is an array of the files in `~/documents`
})

ofType(pathToContents, ['directory', 'symbolicLink'], (err, result) => {

  // => `result` is an array of the dirs and symlinks in `~/documents`
})

API

ofType(pathToContents, [type ...], callback)

Arguments:

  • pathToContents - a path (relative to your user home) which contains the items you wish to filter.
  • type - a string (or array of strings) representing the item type(s) you wish to filter by. The values of type must correspond to the names found in the fs.Stats object. (file, directory, blockDevice, symbolicLink, etc.)
  • callback(err, results) - a function to be invoked when the filtering has completed. results is an array of the items of type type.

License

MIT © Kevin Donahue

Current Tags

  • 1.1.8                                ...           latest (4 years ago)

25 Versions

  • 1.1.8                                ...           4 years ago
  • 1.1.6                                ...           4 years ago
  • 1.0.7                                ...           4 years ago
  • 1.0.6                                ...           4 years ago
  • 1.0.4                                ...           4 years ago
  • 1.0.3                                ...           4 years ago
  • 1.0.0                                ...           4 years ago
  • 0.1.9                                ...           4 years ago
  • 0.1.8                                ...           4 years ago
  • 0.1.7                                ...           4 years ago
  • 0.1.6                                ...           4 years ago
  • 0.1.5                                ...           4 years ago
  • 0.1.4                                ...           4 years ago
  • 0.1.3                                ...           4 years ago
  • 0.1.2                                ...           4 years ago
  • 0.1.1                                ...           4 years ago
  • 0.1.0                                ...           4 years ago
  • 0.0.8                                ...           4 years ago
  • 0.0.7                                ...           4 years ago
  • 0.0.6                                ...           4 years ago
  • 0.0.5                                ...           4 years ago
  • 0.0.4                                ...           4 years ago
  • 0.0.3                                ...           4 years ago
  • 0.0.2                                ...           4 years ago
  • 0.0.1                                ...           4 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (9)
Dev Dependencies (7)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |