Skip to content

Instantly share code, notes, and snippets.

@devarajchidambaram
Last active January 22, 2018 04:42
Show Gist options
  • Save devarajchidambaram/dc0764565e996021d63a83e93deafdf1 to your computer and use it in GitHub Desktop.
Save devarajchidambaram/dc0764565e996021d63a83e93deafdf1 to your computer and use it in GitHub Desktop.
Access File descriptor in nodejs
const fs = require('fs')
fs.open('./index.js', 'r', (err, fd) => {
//Access fd here
if(err) return "error while open FD";
fs.readFile(fd, function(err, msg) {
if(err) return "error while read file";
console.log('msg===', msg.toString())
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment