An open API service indexing awesome lists of open source software.

https://github.com/bin-huang/apjson

append json file in correct format and more easy
https://github.com/bin-huang/apjson

Last synced: 6 months ago
JSON representation

append json file in correct format and more easy

Awesome Lists containing this project

README

          

# why?
![why](https://raw.githubusercontent.com/Ben-Hwang/apjson/master/img/why.png)

# install
```
npm install apjson
```

# how to use?
```javascript
const Apjson = require("apjson");
const jsonFile = new Apjson("example.json");

jsonFile.append({title: "hello, world"});

jsonFile.append({
title: "test1",
time: "20:49",
});

jsonFile.close();
```

## new Apjson(path, [space])
| parameter | type | default |
| -- | -- | -- |
| path | string | null |
| space | number | 2 |

## Apjson.prototype.append(item)
| parameter | type |
| -- | -- |
| item | object |

append stringified object

## Apjson.prototype.close()
when you are not adding more, close the writable stream.