27 lines
1.3 KiB
Markdown
27 lines
1.3 KiB
Markdown
|
[![view on npm](http://img.shields.io/npm/v/fs-then-native.svg)](https://www.npmjs.org/package/fs-then-native)
|
||
|
[![npm module downloads](http://img.shields.io/npm/dt/fs-then-native.svg)](https://www.npmjs.org/package/fs-then-native)
|
||
|
[![Build Status](https://travis-ci.org/75lb/fs-then-native.svg?branch=master)](https://travis-ci.org/75lb/fs-then-native)
|
||
|
[![Coverage Status](https://coveralls.io/repos/github/75lb/fs-then-native/badge.svg?branch=master)](https://coveralls.io/github/75lb/fs-then-native?branch=master)
|
||
|
[![Dependency Status](https://david-dm.org/75lb/fs-then-native.svg)](https://david-dm.org/75lb/fs-then-native)
|
||
|
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](https://github.com/feross/standard)
|
||
|
|
||
|
# fs-then-native
|
||
|
|
||
|
A minimal wrapper around the [Node.js fs library](https://nodejs.org/dist/latest-v6.x/docs/api/fs.html) adding a Promise API. It uses whichever `Promise` implementation is available, leaving responsibility one exists to the user.
|
||
|
|
||
|
## Synopsis
|
||
|
|
||
|
```js
|
||
|
fs.readFile('file.txt', 'utf8')
|
||
|
.then(content => {
|
||
|
// process file content
|
||
|
})
|
||
|
.catch(err => {
|
||
|
// handle exception
|
||
|
})
|
||
|
```
|
||
|
|
||
|
* * *
|
||
|
|
||
|
© 2016-17 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).
|