stdf-parser
v2.0.2
Published
Standard Test Data Format V4 parser
Downloads
347
Maintainers
Readme
STDF parser
Standard Test Data Format V4 parser
Cli
npm install -g stdf-parser
stdf-parser a.stdf
less a.stdf.ndjson
Usage
Stream Parser (Recommended for large file)
import {StdfParser} from 'stdf-parser'
import {once} from 'events'
const stream = createReadStream(filename)
const parser = stream.pipe(StdfParser.stream())
for await (const record of parser) {
if (record instanceof PtrRecord) {
console.log(record)
}
}
Buffer Parser (Faster for small file)
import {StdfParser} from 'stdf-parser'
const file = readFileSync(filename)
console.time('parse')
const stdfFile = StdfParser.parse(SmartBuffer.fromBuffer(file))
console.log(stdfFile.records.length)
warning: may use 2-3 times memory of file size