1.0.1 • Published 7 years ago

promisified-fs v1.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

promisified-fs

node version npm version build status code style

A promisified version of fs.

Many fs methods are converted into promises. Any properties that aren't asynchronous will simply be proxied.

Installation & Usage

npm install promisified-fs
const fs = require('promisified-fs')

fs.access('filename.txt', fs.constants.W_OK)
    .then(function () {
        console.log('Can write!')
    })
    .catch(function (error) {
        console.log('No access!')
    })

With ES2017 async/await:

const fs = require('promisified-fs')

async function doSomething () {
    const data = await fs.readFile('filename.txt')
    // do something
}

License

MIT