1. wrap-stream
Wrap the output of a stream with a prefix and/or suffix
wrap-stream
Package: wrap-stream
Created by: hughsk
Last modified: Wed, 29 Jun 2022 03:44:18 GMT
Version: 2.0.0
License: MIT
Downloads: 1,132
Repository: https://github.com/hughsk/wrap-stream

Install

npm install wrap-stream
yarn add wrap-stream

wrap-stream unstable

Wrap the output of a stream with a prefix and/or suffix.

Streams2 compliant.

Usage

wrap-stream

wrap(pre, post)

Returns a through stream that adds pre before any other output and post
after calling stream.end().

 var wrap = require('wrap-stream')
var fs = require('fs')

fs.createReadStream(__filename)
  .pipe(wrap('hello', 'world'))
  .pipe(process.stdout)

If you'd prefer not to use either of pre or post, just pass null in its
place.

 var wrap = require('wrap-stream')
var fs = require('fs')

fs.createReadStream(__filename)
  .pipe(wrap(null, 'lorem ipsum'))
  .pipe(process.stdout)

License

MIT. See LICENSE.md for details.

Dependencies

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code