Skip to content

Instantly share code, notes, and snippets.

@mariyadiminsky
Created July 11, 2016 20:52
Show Gist options
  • Save mariyadiminsky/597d52a7f082fbc352d068a82e12f120 to your computer and use it in GitHub Desktop.
Save mariyadiminsky/597d52a7f082fbc352d068a82e12f120 to your computer and use it in GitHub Desktop.
// blocking / sync code:
// you have to require the file system(fs), Node.js's core module for it to work:
var fs = require('fs');
// First read the file 'wishlist.html' synchronously using the readFileSync method:
// We have to use the toString because it returns as a buffer.
// You can learn about buffers in the resources I provide at the end of this article.
var wishlist = fs.readFileSync('wishlist.html').toString();
//print the file
console.log(wishlist);
// Do another thing:
console.log('ALERT: Pounce owner!!!');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment