Basic Usage
Blowson can either be used as a parsing function in your Node script or as a CLI tool.

Add package to Node project

$ npm i blowson --save

Create a sample file "data.js"

Your sample data file:
1
const userCount = 50;
2
const commentCount = 250;
3
4
module.exports = {
5
"users": [
6
{ "id": 1, "firstname": "Mike", "age": 12 },
7
{ "id": userCount, "firstname": "Lucy", "age": 31 }
8
],
9
"comments": [
10
{ "id": 1, "user_id": 1, "text": "Some text" },
11
{ "id": commentCount, "user_id": userCount, "text": "Some more text" }
12
]
13
};
Copied!

Parse sample data in Node script

And than in your script:
1
const blowson = require('blowson');
2
const data = require('./data.js');
3
4
const extendedData = blowson(data);
5
6
console.log(extendedData);
Copied!
The blowson function accepts either a JSON string or a JSON like JavaScript object. In case of a JSON string, a nicelly formatted string is being returned. This however involves some extra parsing on the side of Blowson, so we recommend using a JSON like JS object.
Have a look at the index.js for a complete example and check out data.js for an example data file.

CLI Usage

You can use Blowson as a CLI script. All you need to do is install the package globally:
1
$ npm install -g blowson
Copied!
And than run it like this:
1
$ blowson data.js data-extended.js
Copied!
Or:
1
$ blowson data.json data-extended.json
Copied!
Last modified 3yr ago