Skip to content

Instantly share code, notes, and snippets.

@MariusBongarts
Last active August 2, 2023 06:20
Show Gist options
  • Save MariusBongarts/4342612dfed90ecf8be8769b8d4287d2 to your computer and use it in GitHub Desktop.
Save MariusBongarts/4342612dfed90ecf8be8769b8d4287d2 to your computer and use it in GitHub Desktop.
Node file reading (old)
(async () => {
let fileResource;
try {
fileResource = await fs.open("file.txt", "r");
// Do stuff with fileResource
} finally {
await fileResource?.close();
console.log("Cleanup done");
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment