Skip to content

Repository files navigation

hypersim-parser

Build StatusJavaScript Style Guide

Streaming ndjson parser and metrics aggregator for hyper-simulator

Install

npm install hypersim-parser

Usage

const{ createReadStream }=require('fs')const{ BasicTimeline }=require('hypersim-parser')constparser=newBasicTimeline()// Register a custom aggregatorparser.pushReducer('version',(prev,{ type, event, seq })=>{if(type!=='custom'&&event!=='block')return0returnseq})// 'snapshot' event is emitted once for each tick in the simulation's timelineparser.once('snapshot',(snapshot,iteration)=>{console.log(snapshot)snapshot.version// contains the result the custom reducer/aggregator.})// 'close' is fired once all events has been traversed.parser.once('close',()=>console.log('Parsing complete'))// The parser implements a Writable stream, and accepts// ndjson in chunks of Buffer | Uint8Array | stringconstreadable=fs.createReadStream('swarm-log.json')readable.pipe(parser)

Contributing

Ideas and contributions to the project are welcome. You must follow this guideline.

License

GNU AGPLv3 © Tony Ivanov

About

Log parser and metrics aggregator for hyper-simulator output

Resources

Contributing

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages