1.1.3 • Published 5 years ago

stdfjs v1.1.3

Weekly downloads
12
License
ISC
Repository
github
Last release
5 years ago

Parses stdf files into records or parts.

It is written in pure javascript.

It is currently in its alpha state, which means it may have bugs, may be unstable.

But at least you now have a package to process stdf file.

Usage

to Install

npm i stdfjs --save

to Use

const stdf = require('stdfjs')
const got = require('got')
const bz2 = require('unbzip2-stream')
const fs = require('fs')

// get the demo stdf file from internet
let stdfbz2 = got.stream(
  'https://sourceforge.net/p/freestdf/libstdf/ci/master/tree/tests/stdf.bz2?format=raw'
)

// the demo file is in bzip2 format, so pipe it to decompress
let rs = stdfbz2.pipe(bz2())

// feed the raw stdf stream to stdf parser
let parser = stdf
  .parser()
  .on('rec', r => {
    console.log('%j', r)
  })
  .on('part', p => {
    console.log('%j', p)
  })

rs.on('data', ck => {
  parser.push(ck)
}).on('end', () => {
  parser.push()
})

Note

Because the new implementation uses DataView instead of node Buffer, the performance is about 3 times slower than version 1.0.x (commit ID 6083137cdf6a4f5f3c876e634e6c797ed44c810a).

But this change enables the availability of this package in browser.

1.1.3

5 years ago

1.1.2

5 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago