Skip to content

Instantly share code, notes, and snippets.

@antklim
Last active September 27, 2022 19:43
Show Gist options
  • Save antklim/2a8016ae0b6260279e6b2e518fc8ace1 to your computer and use it in GitHub Desktop.
Save antklim/2a8016ae0b6260279e6b2e518fc8ace1 to your computer and use it in GitHub Desktop.
import { readFile } from 'node:fs';
const readFileCallback = (err: Error | null, data: string | Buffer) => {
if (err) {
console.log(err);
return;
}
// process data ...
console.log(data.length);
}
const main = () => {
readFile('/tmp/data', readFileCallback);
}
main();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment