Socket
Book a DemoInstallSign in
Socket

streaming-format

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

streaming-format

Simple streaming formatter

latest
Source
npmnpm
Version
2.0.2
Version published
Maintainers
1
Created
Source

streaming-format

Simple streaming formatter

npm install streaming-format

build status

Usage

Assuming you have a stream that contains handlebars format values like

... BIG DATA ...
{{hello}} world
... MORE BIG DATA ...

And you want to replace {{hello}} with a another value without reading the entire stream into memory use this module

var format = require('streaming-format')

bigData
  .pipe(format(function(name) {
    return name.toUpperCase()
  }))
  .pipe(process.stdout)

Which will produce

... BIG DATA ...
HELLO world
... MORE BIG DATA ...

API

var stream = format([opts], replacer) where opts can contain

{
  start: '{{', // set the format start string
  end: '}}'    // set the format end string
}

Command line tool

There is also a command line tool available

npm install -g streaming-format
echo 'hello {{hello}}' | format --hello world # prints hello world

License

MIT

Keywords

stream

FAQs

Package last updated on 28 Apr 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts