Skip to content

Instantly share code, notes, and snippets.

@bclinkinbeard
Forked from techwraith/write-file.js
Created January 28, 2014 01:32
Show Gist options
  • Select an option

  • Save bclinkinbeard/8660892 to your computer and use it in GitHub Desktop.

Select an option

Save bclinkinbeard/8660892 to your computer and use it in GitHub Desktop.
module.exports = function (path, opts) {
return function (err, src) {
if (!opts) opts = {}
if (!path) throw new Error('Path must be provided')
if (err) {
throw err
}
fs.writeFileSync(path, src, 'utf8');
if (opts.debug) console.log('writing to ' + path)
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment