Skip to content

Instantly share code, notes, and snippets.

@navanathjadhav
Created June 14, 2022 15:45
Show Gist options
  • Save navanathjadhav/9675c37b3dfe9458e0b939133db60da3 to your computer and use it in GitHub Desktop.
Save navanathjadhav/9675c37b3dfe9458e0b939133db60da3 to your computer and use it in GitHub Desktop.
Code Example for Asynchronous functions
import { readFile } from 'node:fs';
/*
* Read file asynchronously
* Non blocking code
*/
readFile('/sample.txt', (err, data) => {
if (err) throw err;
console.log(data);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment