To buffer entire file in memory with Node.js, we call readFile
.
For instance, we write
const fs = require("fs");
fs.readFile("/etc/passwd", (err, data) => {
// ...
});
to call readFile
to open the /etc/passwd file.
And we get the open file data from data
.