1
2
3
4
5
6
7
8
9
10
11
12
13
| const fs = require("fs");
|
| const readStream = fs.createReadStream("./in.txt");
| const writeStream = fs.createWriteStream("./out.txt");
|
| readStream.on("data", (data /* Buffer */) => {
| // process data here
| writeStream.write(data)
| });
|
| readStream.on("end", (data) => {
| // stream has finished, e.g. EOF (end of file)
| });
|
|