Skip to content

Instantly share code, notes, and snippets.

@legend80s
Created October 17, 2016 08:30
Show Gist options
  • Save legend80s/e40a1cbf241a281a86b86fe3ad2ec29d to your computer and use it in GitHub Desktop.
Save legend80s/e40a1cbf241a281a86b86fe3ad2ec29d to your computer and use it in GitHub Desktop.
thunks for fs
// https://github.com/tj/co-fs/blob/master/index.js
const fs = require('fs');
function accessThunk(dir) {
return (cb) => {
fs.access(dir, (err) => cb(null, !err));
};
}
function mkdirThunk(dir) {
return (cb) => {
fs.mkdir(dir, (err) => cb(null, !err));
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment