Created
July 10, 2015 00:04
-
-
Save sebv/a4cb31595c46b6648f18 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import _fs from 'fs'; | |
import assert from 'assert'; | |
var B = require('bluebird'); | |
let fs = { | |
open: B.promisify(_fs.open), | |
mkdir: B.promisify(_fs.mkdir), | |
exists: B.promisify( | |
function (path, done) { | |
_fs.exists (path, function (result) { | |
done(null, result); | |
}); | |
}) | |
}; | |
fs.exists('qwerty').then((res) => { | |
assert(!res); | |
}).then(function() { | |
return fs.exists(__dirname); | |
}).then(function(res) { | |
assert(res); | |
}).then(function() { | |
return fs.exists(__dirname + '/bid.js'); | |
}).then(function(res) { | |
assert(res); | |
}).done(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment