JSPM

fs-readdir-promise

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 13
  • Score
    100M100P100Q58241F

Promises/A+ version of fs.readdir

Package Exports

  • fs-readdir-promise

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (fs-readdir-promise) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

fs-readdir-promise

Build Status Build status Coverage Status Dependency Status devDependency Status

Promises/A+ version of fs.readdir

var readdir = require('fs-readdir-promise');

readdir('path/to/dir')
.then(function(files) {
  console.log(files);
})
.catch(function(err) {
  console.log(err.message);
});

Installation

NPM version

Use npm.

npm install fs-readdir-promise

API

var readdir = require('fs-readdir-promise');

readdir(path)

path: String
Return: Object (Promise)

When it finish reading the directory, it will be fulfilled with an Array of file names in the directory as its first argument.

When it fails to read the directory, it will be rejected with an error as its first argument.

var readdir = require('fs-readdir-promise');

var onFulfilled = function(files) {
  console.log(files);
};

var onRejected = function(err) {
  console.log('Cannot read the file.');
};

readdir('path/to/file').then(onFulfilled, onRejected);

License

Copyright (c) 2014 Shinnosuke Watanabe

Licensed under the MIT License.