Skip to content

Instantly share code, notes, and snippets.

@constvoidblog
Last active October 29, 2017 23:51
Show Gist options
  • Save constvoidblog/895d428b0748f908aa3b5beea6997e81 to your computer and use it in GitHub Desktop.
Save constvoidblog/895d428b0748f908aa3b5beea6997e81 to your computer and use it in GitHub Desktop.
A sample function
const fs = require(‘fs’);
function foo (a, b, f) {
new Promise((resolve,reject)=>
let c=a*b;
fs.writeFile(f,`${a} * ${b} = ${c}`, (err) => { if (err) { console.log(`issue writing data to ${f}: ${err}`); reject (err); }
resolve(c);
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment