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

https://github.com/itaibo/momoa

Operations with JSONs
https://github.com/itaibo/momoa

etl gzip json

Last synced: 2 months ago
JSON representation

Operations with JSONs

Awesome Lists containing this project

README

          

# Momoa
![CI](https://github.com/itaibo/momoa/actions/workflows/ci.yml/badge.svg)

Operations with JSONs

## Usage
Install the package:
```sh
npm install momoa
```

Then import it in your application and start an instance
```js
import Momoa from 'momoa';
const momoa = new Momoa();
```

### Enlist JSON Array

```js
const multilineString = await momoa.enlist([{ test: 1 }, { test: 2 }, { test: 3 }]).output();
console.log(multilineString);
```

Output would be:

```txt
{"test":1}
{"test":2}
{"test":3}

```

### Unlist JSON String

```js
const array = await momoa.unlist("{\"test\":1}").json();
console.log(array);
```

Output would be:

```json
[
{ "test": 1 }
]
```

### Gzip results

```js
const gzipped = await momoa.enlist([{ test: 1 }, { test: 2 }, { test: 3 }]).gzip().end();
console.log(gzipped);
```

Output would be:

```txt

```

### UnGzip

```js
const uncompressed = await momoa.ungzip(BUFFER).end();
console.log(uncompressed);
```

Output would be:

```txt
{"test":1}
{"test":2}
{"test":3}

```

#### Special thanks
Chaining async functions: [Proxymise](https://www.npmjs.com/package/proxymise)