JSPM

fs-then

0.2.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 50
  • Score
    100M100P100Q64966F

Promise aware wrapper for Node's fs module

Package Exports

  • fs-then

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-then) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

fs Then

Build Status

Thin wrapper arround Node's fs module that makes the async functions promise aware. The wrapped methods return a promise the represents the value of the async operation. Traditional callbacks still work, allowing for a transparent drop-in for fs. Sync methods, classes and other helpers are not modified.

Example

Traditional Async

var fs = require('fs-then');
fs.readFile('path to file', function (err, buffer) {
   ...
});

With Promises

var fs = require('fs-then');
fs.readFile('path to file').then(...);

Wrapped methods

  • appendFile
  • chmod
  • chown
  • close
  • exists
  • fchmod
  • fchown
  • fdatasync
  • fstat
  • fsync
  • ftruncate
  • futimes
  • lchmod
  • lchown
  • link
  • lstat
  • mkdir
  • open
  • read
  • readFile
  • readdir
  • readlink
  • realpath
  • rename
  • rmdir
  • stat
  • symlink
  • truncate
  • unlink
  • utimes
  • write
  • writeFile