You are given the following code snippet. At the moment, the code outputs a buffer to the console. Change the code so that it outputs the string data types written in the data.txt file to the console.
What are streams?
We need strings
Report a typo
Sample Input 1:
Sample Output 1:
trueWrite a program in JavaScript
const fs = require("fs");
function main() {
const readerStream = fs.createReadStream('./data.txt');
readerStream.on('data', (chunk) => {
console.log(chunk)
})
};
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.