Computer scienceBackendNode.jsCore ConceptsInternal modulesFile system module

Write stream

Fix order

Report a typo

Put the code snippets into the correct order. The code should read from one source and write it to another one. As a result, you should see the joke-copy.txt file created, which is a copy of joke.txt.

Put the items in the correct order
const fs = require('node:fs');
readableStream.on('data', function(chunk) {
writableStream.write(chunk);
});
const readableStream = fs.createReadStream('joke.txt');
const writableStream = fs.createWriteStream('joke-copy.txt');
readableStream.setEncoding('utf8');

Create a free account to access the full topic