0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-10-29 08:58:01 -04:00
denoland-deno/tests/specs/node/node_debug/main.mjs
2024-04-29 09:36:53 +00:00

14 lines
440 B
JavaScript

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);
});