Computer scienceBackendNode.jsCore ConceptsInternal modulesStreams

Introduction to Streams module

Detect finishing

Report a typo

Complete the following code to detect when the stream has finished emitting data.

const { finished } = require('node:stream/promises');
const fs = require('node:fs');

async function run() {
    const stream = fs.createReadStream('file.txt');
    await ______(stream);
    console.log('Stream complete.');
}

run().catch(console.error);

You need to write the whole line!
Enter a short text
___

Create a free account to access the full topic