array-to-ndjson

Convert an array of objects to ndjson format

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
array-to-ndjson
1.0.17 years ago7 years agoMinified + gzip package size for array-to-ndjson in KB

Readme

array-to-ndjson Build Status
Convert an array of objects to a stream of ndjson data.

Install

$ npm install array-to-ndjson

Usage

const arrayToNdjson = require('array-to-ndjson');

arrayToNdjson([{name: 'Foo', value: 10}]);
	// => Readable Stream


// Example piping the stream

arrayToNdjson([{name: 'Foo', value: 10}, {name: 'Bar', value: 9}])
	.pipe(fs.createWriteStream('foo.json'))
	// => File will contain:
	//
	// {"name":"Foo","value":10}
	// {"name":"Bar","value":9}

API

arrayToNdjson(input)

input

Type: Object[]
Array of objects that you want to convert to NDJSON format.

License

MIT © Simon