1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-15 11:58:42 -05:00
denoland-deno/tests/specs/node/node_debug/main.mjs

15 lines
440 B
JavaScript
Raw Normal View History

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