Skip to content

rich-b/json-cat-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

json-cat-parser

concatenated json parser

Read chunks of json as they become available

Usage

import getParser from 'json-cat-parser';

const outputStream = await getParser("http://www.someLocation.com", {
  itemArrayElementName: "results"
});

const outputArrays = [];

outputStream.on("data", outputChunk => {
  const itemsArray = JSON.parse(arrayBufferToString(outputChunk));
  outputArrays.push(...itemsArray);

  // do whatever processing you need to for the entities returned
});

outputStream.on("end", () => {
  // anything you need to do when the request completed
});

config parameter

the config parameter to getParser currently only has the itemArrayElementName property. This property tells the parser where to locate the array of entities that it should parse.

About

concatenated json parser for streaming chunks of json

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published