# fs-extra-promise

> Node file system library and fs-extra module promisified with bluebird

Latest version **1.0.1** (published 2017-04-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install fs-extra-promise
pnpm add fs-extra-promise
yarn add fs-extra-promise
bun add fs-extra-promise
```

## Health

**Score 23/100 (F)** — status: abandoned.

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2017-04-08 |
| First published | 2014-11-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/fs-extra-promise) |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Overlook Motel |
| Maintainers | overlookmotel |
| Keywords | fs, fs-extra, file, promise, bluebird, extend |

## Links

- npm: https://www.npmjs.com/package/fs-extra-promise
- Repository: https://github.com/overlookmotel/fs-extra-promise
- Homepage: https://github.com/overlookmotel/fs-extra-promise#readme
- Issues: https://github.com/overlookmotel/fs-extra-promise/issues
- npm.io page: https://npm.io/package/fs-extra-promise

## Dependencies (2)

- [bluebird](https://npm.io/package/bluebird.md) ^3.5.0
- [fs-extra](https://npm.io/package/fs-extra.md) ^2.1.2

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2017-04-08
- 1.0.0 — 2017-04-08
- 0.4.1 — 2016-09-12
- 0.4.0 — 2016-06-11
- 0.3.1 — 2015-11-04
- 0.3.0 — 2015-09-28
- 0.2.1 — 2015-09-09
- 0.2.0 — 2015-07-07
- 0.1.3 — 2015-05-27
- 0.1.2 — 2015-05-26
- 0.1.1 — 2015-04-24
- 0.1.0 — 2014-11-16
- 0.0.1 — 2014-11-15

## README

# fs-extra-promise.js

# Node file system library and fs-extra module promisified with bluebird

## Current status

[![NPM version](https://img.shields.io/npm/v/fs-extra-promise.svg)](https://www.npmjs.com/package/fs-extra-promise)
[![Build Status](https://img.shields.io/travis/overlookmotel/fs-extra-promise/master.svg)](http://travis-ci.org/overlookmotel/fs-extra-promise)
[![Dependency Status](https://img.shields.io/david/overlookmotel/fs-extra-promise.svg)](https://david-dm.org/overlookmotel/fs-extra-promise)
[![Dev dependency Status](https://img.shields.io/david/dev/overlookmotel/fs-extra-promise.svg)](https://david-dm.org/overlookmotel/fs-extra-promise)
[![Coverage Status](https://img.shields.io/coveralls/overlookmotel/fs-extra-promise/master.svg)](https://coveralls.io/r/overlookmotel/fs-extra-promise)

API is stable. No tests at present but it seems to work fine!

## Usage

This module is a drop-in replacement for the [native node file system module](http://nodejs.org/api/fs.html) and the augmented [fs-extra](https://www.npmjs.org/package/fs-extra) module.

Additionally, it creates promisified versions of all `fs`'s and `fs-extra`'s async methods, using [bluebird](https://www.npmjs.org/package/bluebird). 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:

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

You can now:

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

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

### `isDirectory()` methods

For convenience, additional methods `isDirectory()`, `isDirectorySync()` and `isDirectoryAsync()` are provided.

These are are shortcuts for doing `fs.stat()` followed by running `isDirectory()` on the result returned by `stat()`.

### `usePromise()` method

Creates a new instance of `fs-extra-promise`, which uses the Promise implementation provided.

```js
var Bluebird = require('bluebird');
var fs = require('fs-extra-promise').usePromise(Bluebird);

// now use `fs-extra-promise` in the usual way
var promise = fs.readFileAsync(path);

console.log(promise instanceof Bluebird); // true
```

This can be useful for:

* using a different version of [bluebird](https://www.npmjs.com/package/bluebird)
* using a Promise implementation that supports `cls`
* using an augmented version of Bluebird like [bluebird-extra](https://www.npmjs.org/package/bluebird-extra)

### `useFs()` method

Creates a new instance of `fs-extra-promise`, promisifying the provide version of [fs-extra](https://www.npmjs.org/package/fs-extra).

Most useful if you want to use a specific version of [fs-extra](https://www.npmjs.org/package/fs-extra).

```js
var fs = require('fs-extra-promise').useFs(require('fs-extra'));
```

## Tests

Use `npm test` to run the tests. Use `npm run cover` to check coverage.

There aren't any tests at present, except for running jshint on the code.

## Changelog

See [changelog.md](https://github.com/overlookmotel/fs-extra-promise/blob/master/changelog.md)

## Issues

If you discover a bug, please raise an issue on Github. https://github.com/overlookmotel/fs-extra-promise/issues

---
_Source: https://npm.io/package/fs-extra-promise · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
