NoNode.js · Lesson 2 of 7
File System
Node's `fs` module gives you full control over the file system. The promises API (`fs/promises`) is the modern way — no callbacks needed.
✦ Tip
Use streams (`createReadStream`, `pipeline`) for files larger than ~50MB. Reading the whole file into memory with `readFile` will fail or slow down on large inputs. The `readline` interface combined with `for await` is the idiomatic way to process files line by line.
Use streams (`createReadStream`, `pipeline`) for files larger than ~50MB. Reading the whole file into memory with `readFile` will fail or slow down on large inputs. The `readline` interface combined with `for await` is the idiomatic way to process files line by line.