Last active
August 13, 2025 08:13
-
-
Save gabri83/41acc5d8b54773884b3a61692b2c024f to your computer and use it in GitHub Desktop.
Read a File Line by Line (Node.js)
This file contains hidden or 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
| const fs = require('fs'); | |
| fs.readFile('example.txt', 'utf8', (err, data) => { | |
| if (err) throw err; | |
| data.split('\n').forEach(line => { | |
| console.log(line); | |
| }); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment