Skip to content

Filter stream that keeps selected JSON object strings that retains selected object structures

License

Notifications You must be signed in to change notification settings

angleman/json-mask-stream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

# json-mask-stream

Pass thru specific parts of a JSON object strings in a stream and preserves the structure of the included elements.

Install

npm install json-mask-stream

Usage

Sample logfile.json line:

{"ip": "198.55.125.23", "timestamp":"2014-02-24 10:29:42", "url": "http:\/\/somedomain.com"}
var fs             = require('fs');
var logstream      = fs.createReadStream('logfile.json');
var split          = new require('split')();
var JsonMaskStream = require('json-mask-stream');
var maskStream     = new JsonMaskStream('url,timestamp');

logstream
.pipe(split)
.pipe(maskStream)
.pipe(process.stdout) //  {"url": "http:\/\/somedomain.com", "timestamp":"2014-02-24 10:29:42"}

License

MIT

About

Filter stream that keeps selected JSON object strings that retains selected object structures

Resources

License

Stars

Watchers

Forks

Packages

No packages published