token-filter

0.2.3 • Public • Published

token-filter

A Transform stream that replaces delimited keys (tokens) with matching values, like the Ant Filter task.

Build Status

Usage

var fs = require('fs');
var tokenFilter = require('token-filter');
 
// input.txt => "Hello, @name@!"
fs.createReadStream('input.txt')
    .pipe(tokenFilter({ name: "World" }))
    .pipe(fs.createWriteStream('output.txt'));
// output.txt => "Hello, World!"

API

tokenFilter(context, [options])

  • context {Object} Values to interpolate into matched keys.
  • options {Object} (optional)
    • tokenDelimiter {String} The string that begins and ends a token (default "@").
    • highWaterMark {Number} The stream's highWaterMark, defaulting to fs.ReadStream's default (64KB).

Additional stream options are detailed in the core manual.

Readme

Keywords

none

Package Sidebar

Install

npm i token-filter

Weekly Downloads

1

Version

0.2.3

License

MIT

Last publish

Collaborators

  • evocateur