kcwiki / stream-bson

Streaming BSON parser with rudimentary MongoDB archive support

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

stream-bson

Version

Streaming BSON parser with rudimentary MongoDB archive support.

  • bson is used for parsing, it is faster than bson-ext according to some tests.

Install

$ npm i stream-bson
# or
$ yarn add stream-bson

Usage

const { createReadStream } = require('fs')
const StreamBSON = require('stream-bson')

createReadStream('...')
  .pipe(new StreamBSON({ archive: true }))
  .on('data', doc => {})
  .on('finish', () => {})
  .on('error', err => {})

Todo

  • Proper exception handling / multistream support.
  • MongoDB archives are not parsed properly. Assuming there is a BSON file in the archive, setting archive in StreamBSON options will skip the archive header (until \x07_id) and ignore the footer (via parsing error).

About

Streaming BSON parser with rudimentary MongoDB archive support


Languages

Language:JavaScript 100.0%