Skip to content

Instantly share code, notes, and snippets.

@ilovejs
Created August 6, 2014 06:04
Show Gist options
  • Save ilovejs/763b6692d84f6a16af76 to your computer and use it in GitHub Desktop.
Save ilovejs/763b6692d84f6a16af76 to your computer and use it in GitHub Desktop.
await_reading_file for tamejs
require('tamejs').register();
var fs = require('fs');
var filename = 'tjs/tokenFile.txt';
var token = '123456';
function readAccessCode(filename, cb){
var data;
await fs.readFile(filename, "utf-8", defer(err, data));
if(!err){
cb(err, data);
}
}
await {
readAccessCode(filename, defer(err, res));
}
if(!err){
console.log(res);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment