# json-content-demux

> Break up JSON from content in a JSON-first file

Latest version **0.2.0** (published 2020-06-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install json-content-demux
pnpm add json-content-demux
yarn add json-content-demux
bun add json-content-demux
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2020-06-30 |
| First published | 2012-11-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 10.0.0 |
| Dependencies | 0 |
| Unpacked size | 8.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Todd Wolfson |
| Maintainers | twolfson |
| Keywords | json, content, demux, combined, splitter, breaker, break up |

## Links

- npm: https://www.npmjs.com/package/json-content-demux
- Repository: https://github.com/twolfson/json-content-demux
- Issues: https://github.com/twolfson/json-content-demux/issues
- npm.io page: https://npm.io/package/json-content-demux

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.2.0 (latest) — 2020-06-30
- 0.1.4 — 2020-06-30
- 0.1.3 — 2013-06-19
- 0.1.2 — 2012-11-18
- 0.1.1 — 2012-11-17
- 0.1.0 — 2012-11-17
- 0.0.0 — 2012-11-17

## README

# json-content-demux

Break up JSON from content in a JSON-first file

## Getting Started
Install the module with: `npm install json-content-demux`

```javascript
// muxed.md
{
  "title": "This is some muxed JSON and content",
  "options": {
    "Hello": "World!"
  }
}

Here is some content
Om nom nom


// app.js
var jsonContentDemux = require('json-content-demux'),
    muxedContent = fs.readFileSync('muxed.md', 'utf8'),
    demuxedObj = jsonContentDemux(muxedStr);
demuxedObj.json; // {"title":"This is some muxed...","options"}
demuxedObj.content; // "Here is some content\nOm nom nom"
```

## Documentation
jsonContentDemux is currently a single function module with a single purpose.
```js
/**
 * @param {String} muxStr Muxed content to break up
 * @returns {Object} retObj
 * @returns {Object} retObj.json JSON found at the head of the content
 * @returns {String} retObj.content Content found in the body
 */
```

At some point, the scope may increasee to encapsulate any markup language as well as multiple sets of delimited items.

## Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint via `npm run lint` and test via `npm test`.

## Donating
Support this project and [others by twolfson][twolfson-projects] via [donations][twolfson-support-me].

<http://twolfson.com/support-me>

[twolfson-projects]: http://twolfson.com/projects
[twolfson-support-me]: http://twolfson.com/support-me

## License
Copyright (c) 2012 Todd Wolfson
Licensed under the MIT license.

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