Computer scienceBackendNode.jsCore ConceptsInternal modulesStreams

Introduction to Streams module

Reading a file

Report a typo

Sort the following steps in the correct order to read a file using fs and the Streams Promises API in Node.js.

Put the items in the correct order
Define the asynchronous function main()
Create a read stream with fs.createReadStream('input.txt')
Console log 'Pipeline succeeded.'
Catch any errors with .catch(console.error)
Create a write stream with fs.createWriteStream('output.txt')
Require the necessary modules
___

Create a free account to access the full topic