node package manager
Stop writing boring code. Discover, share, and reuse within your team. Create a free org ยป

promised-fs

promised-fs

Provides defer/when style promise based filesystem API for node.js. This alternative API allows writing code in a liniar fasion while still preserving asynchronous behavior.

Example

    var fs = require('promised-fs')
    ,   when = require('q').when

    var somePath = fs.workingDirectory().join('someFile.bla')
    var data = fs.read(somePath)
    var wroteTemp = fs.write('/some/path/temp.bla', data)

    when
    ( wroteTemp
    , function resovled() {
        doSomethingNow()
      }
    , function rejected(error) {
        doSomethingElseIfFailed(error)
      }
    )

Install

npm install promised-fs

Test

npm test promised-fs