🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

fs-extra-async

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fs-extra-async

Node file system library and fs-extra module promisified

0.0.6
Source
npm
Version published
Weekly downloads
8
60%
Maintainers
1
Weekly downloads
 
Created
Source

fs-extra-async

Build Status NPM version Coverage Status

Node file system library and fs-extra module promisified

Usage

This module is a drop-in replacement for the native node file system module and the augmented fs-extra module.

Additionally, it creates promisified versions of all fs's and fs-extra's async methods, using any-promise. These methods are named the same as the original fs/fs-extra methods with 'Async' added to the end of the method names.

So instead of:

var fs = require('fs');
fs.readFile(path, function(err, data) {
	console.log(data);
});

You can now:

var fs = require('fs-extra-async');
fs.readFileAsync(path).then(function(data) {
	console.log(data);
});

With ES2017, this will allow you to use async functions:

import fs from 'fs-extra-async';
(async function fn(args){
	var data = await fs.readJsonAsync('data.json');
	await fs.outputFileAsync('/tmp/markdown/readme.md', data.readme.markdown);
	await fs.outputFileAsync('/tmp/markdown/doc.md', data.doc.markdown);
	await require('open')('/tmp/markdown/readme.md');
	await fs.removeAsync('/tmp/markdown');
})();

All original fs and fs-extra methods are included unmodified.

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.

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

Keywords

fs

FAQs

Package last updated on 12 May 2016

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