structured-stream-writer
A utility for stream-writing CSV and JSON files
Last updated 7 months ago by isnit0 .
MIT · Original npm · Tarball · package.json
$ cnpm install structured-stream-writer 
SYNC missed versions from official npm registry.

StructuredStreamWriter

A utility for stream-writing CSV and JSON files.

npm CodeFactor Build Status codecov NPM License

Usage

npm i structured-stream-writer
import { StructuredStreamWriter, StructuredFormat } from 'structured-stream-writer';
const sswJSON = new StructuredStreamWriter(StructuredFormat.JSON, outPath);

await sswJSON.writeItem({
    item: 1,
    text: 'hello',
});

sswJSON.done();

console.log(
    readFileSync(outPath, 'UTF8'),
);
/*
*  [{item:1,text:"hello"}]
*/

const sswCSV = new StructuredStreamWriter(StructuredFormat.CSV, outPath, ['item', 'text']);

await sswCSV.writeItem({
    item: 1,
    text: 'hello',
});

sswCSV.done();

console.log(
    readFileSync(outPath, 'UTF8'),
);
/* 
*  item,text
*  1,hello
*/

Used By

License - MIT

./LICENSE

Current Tags

  • 1.0.0                                ...           latest (7 months ago)

1 Versions

  • 1.0.0                                ...           7 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (8)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |