Starting with Node.js version 15, the Stream API promise a new "stream/promises" module.
Part of the Stream Promises module is the
finished function. The Function plugs into a stream and resolves a promise when it is no longer readable, writable or has experienced an error or a premature close event.
The promises example leverages
pipe as well as
finished to provide a convenient solution to read a file from the file system and to pipe its output into the parser.
This example is available with the command