diff options
Diffstat (limited to 'tests/specs/node/node_debug/main.mjs')
-rw-r--r-- | tests/specs/node/node_debug/main.mjs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/specs/node/node_debug/main.mjs b/tests/specs/node/node_debug/main.mjs new file mode 100644 index 000000000..b33657982 --- /dev/null +++ b/tests/specs/node/node_debug/main.mjs @@ -0,0 +1,14 @@ +import { createReadStream } from "node:fs"; +import path from "node:path"; + +const filePath = path.join(import.meta.dirname, "hello.txt"); +const readableStream = createReadStream(filePath); +readableStream.on("data", (chunk) => { + console.log(chunk.toString()); +}); +readableStream.on("end", () => { + console.log("Finished reading the file"); +}); +readableStream.on("error", (error) => { + console.error("Error reading the file:", error); +}); |