Which of the following will correctly create a readable stream in Node.js?
4 phương ánCó giải thíchTrung bình
Các phương án trả lời
Chọn một phương ánLời giảiChọn phương án để mở
Để tạo một luồng đọc có thể đọc được trong Node.js, bạn cần sử dụng hàm createReadStream() từ module fs. Hàm này sẽ tạo một luồng đọc từ một tệp tin cụ thể. Ví dụ, bạn muốn đọc nội dung của tệp tin 'input.txt', bạn có thể sử dụng hàm createReadStream() như sau: const fs = require('fs'); const stream = fs.createReadStream('input.txt');. Điều này sẽ tạo một luồng đọc có thể đọc được nội dung của tệp tin 'input.txt'.
Cùng chương 1
Which of the following are valid methods to read a file in Node.js? (Choose 2 answers)Có lời giảiCâu hỏiHow to handle asynchronous operations in a more readable and maintainable way? (Choose 2 answers)Có lời giảiCâu hỏiWhich statements about Promises in Node.js are true? (Choose 2 answers)Có lời giảiCâu hỏiCả 18 câu của chủ đề18 câu