Skip to content

Latest commit

 

History

History
40 lines (30 loc) · 944 Bytes

README.md

File metadata and controls

40 lines (30 loc) · 944 Bytes

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