Socket
Socket
Sign inDemoInstall

fs-promise

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fs-promise

Filesystem methods as promises with fs-extra


Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

fs-promise

Build Status

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

fsp.writeFile('/tmp/hello1.txt', 'hello world')
  .then(function(){
    return fsp.readFile('/tmp/hello1.txt', {encoding:'utf8'});
  })
  .then(function(contents){});

Implementation

fs-promise is now a thin wrapper on top of mz/fs adding support for async functions from fs-extra. If you do not need the functions from fs-extra, consider using mz directly.

  • Proxies async fs and fs-extra methods exposing them as ES 2015 (ES6) compatible promises.
  • Uses any-promise to load preferred Promise implementation.
  • Directly uses mz/fs for all fs functions.
  • Proxies walk from fs-extra to resolve Promise as arrays of items.
  • Proxies the following functions from fs-extra using thenify-all. (Proxies all other functions directly).
[
  'copy',
  'emptyDir',
  'ensureFile',
  'ensureDir',
  'ensureLink'
  'ensureSymlink',
  'mkdirs',
  'move',
  'outputFile',
  'outputJson',
  'readJson',
  'remove',
  'writeJson'
]

Usage

Detects a Promise implementation using any-promise. If you have a preferred implementation, or are working in an environment without a global implementation, you must explicitly register a Promise implementation and it will be used. See any-promise for details.

Typical installation:

$ npm install --save fs-promise

Note that fs-extra depends on graceful-fs, so you will get the benefits of both libraries.

Keywords

FAQs

Package last updated on 26 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc