Прочитать строку с помощью потоковых Nodejs

const stream: InstanceType<typeof PassThrough> = new PassThrough()
stream.write(html)
stream.end()

stream.pipe(createWriteStream(writeFilePath)).on('finish', () => {
  console.info('generate file is working')
})
Restu Wahyu Saputra