# @artemkv/readjsonstream

> Constructs object from Json stream

Latest version **1.0.0** (published 2018-12-19) · ISC license · 0 weekly downloads

## Install

```sh
npm install @artemkv/readjsonstream
pnpm add @artemkv/readjsonstream
yarn add @artemkv/readjsonstream
bun add @artemkv/readjsonstream
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2018-12-19 |
| First published | 2018-12-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 2.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Artem Kondratyev |
| Maintainers | artemkv-owner |

## Links

- npm: https://www.npmjs.com/package/@artemkv/readjsonstream
- npm.io page: https://npm.io/package/@artemkv/readjsonstream

## Dependencies (3)

- [@artemkv/resterror](https://npm.io/package/@artemkv/resterror.md) 1.0.0
- [@artemkv/statuscodes](https://npm.io/package/@artemkv/statuscodes.md) 1.0.2
- [@artemkv/statusmessages](https://npm.io/package/@artemkv/statusmessages.md) 1.0.0

## Recent versions

- 1.0.0 (latest) — 2018-12-19

## README

@artemkv/readjsonstream - Constructs object from Json stream
=======

```js
const MAX_LENGTH = 512;

const readJsonStream = require('@artemkv/readjsonstream');

function (req, res, next) {
    if (req.method !== 'POST') {
        throw new RestError(statusCodes.MethodNotAllowed, statusMessages.MethodNotAllowed);
    }
    let contentType = req.headers['content-type'];
    if (contentType !== 'application/json') {
        throw new RestError(statusCodes.BadRequest, statusMessages.BadRequest);
    }

    let promise = new Promise(readJsonStream(req, MAX_LENGTH));

    promise
        .then(function (data) {
            console.log(data);

            res.statusCode = statusCodes.OK;
            res.end();
        })
        .catch(function (err) {
            next(err);
        });
}
```

---
_Source: https://npm.io/package/@artemkv/readjsonstream · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
