Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chaiwa-berian/b9e3002460e010b90bcf92e32cf83a1e to your computer and use it in GitHub Desktop.
Save chaiwa-berian/b9e3002460e010b90bcf92e32cf83a1e to your computer and use it in GitHub Desktop.
Read a big file without using streams
const fs = require('fs');
const server = require('http').createServer();
server.on('request', (req, res) => {
fs.readFile('./big.file', (err, data) => {
if (err) throw err;
res.end(data);
});
});
server.listen(8000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment