Skip to content

stream: add auto-destroy mode

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

This adds a new options to the stream constructor called autoDestroy that is default false. When autoDestroy is enabled .destroy() will automatically be called when the stream has ended and/or finished depending on whether it's a readable/writable/duplex.

This simplifies error handling / resource management for users as you can then always do your teardown logic in the destroy method.

Merge request reports

Loading