Nodejs streams

From wikinotes
Revision as of 02:52, 6 August 2021 by Will (talk | contribs) (Created page with " = Documentation = <blockquote> {| class="wikitable" |- | official docs || https://nodejs.org/api/stream.html |- | official tutorial || https://nodejs.dev/learn/nodejs-streams...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Documentation

official docs https://nodejs.org/api/stream.html
official tutorial https://nodejs.dev/learn/nodejs-streams

Basics

types of streams

  • Readable
  • Writable
  • Duplex
  • Transform
const Stream = require('stream');

const stream = new Stream.Duplex()
stream.push('')
stream.write('abc')
stream.end()         // signal end of writing