Last active
August 2, 2023 06:20
-
-
Save MariusBongarts/4342612dfed90ecf8be8769b8d4287d2 to your computer and use it in GitHub Desktop.
Node file reading (old)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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