Socket
Socket
Sign inDemoInstall

@discoveryjs/json-ext

Package Overview
Dependencies
Maintainers
3
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@discoveryjs/json-ext

A set of utilities that extend the use of JSON


Version published
Weekly downloads
9.7M
decreased by-14.8%
Maintainers
3
Weekly downloads
 
Created

What is @discoveryjs/json-ext?

The @discoveryjs/json-ext npm package provides utilities for working with JSON data, including features for streaming, parsing, and stringifying large JSON objects and arrays. It is designed to handle JSON data efficiently, making it easier to work with large JSON files or streams of JSON data.

What are @discoveryjs/json-ext's main functionalities?

Streaming JSON parse

This feature allows for parsing newline-delimited JSON (NDJSON) from a stream, enabling efficient processing of large JSON files without loading them entirely into memory.

const { createReadStream } = require('fs');
const { parseNDJSON } = require('@discoveryjs/json-ext');

const stream = createReadStream('path/to/your/file.ndjson');
parseNDJSON(stream, (obj) => {
  console.log(obj);
});

Stringify JSON to stream

This feature allows for stringifying JSON objects and piping them to a writable stream, which is useful for creating NDJSON files or streaming JSON data over the network.

const { createWriteStream } = require('fs');
const { stringifyStream } = require('@discoveryjs/json-ext');

const stream = createWriteStream('path/to/your/output.ndjson');
const objects = [{ foo: 'bar' }, { baz: 'qux' }];

stringifyStream(objects).pipe(stream);

Other packages similar to @discoveryjs/json-ext

Keywords

FAQs

Package last updated on 05 Dec 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc