{"id":26716613,"url":"https://github.com/javascript-studio/studio-ndjson","last_synced_at":"2025-04-14T01:40:22.170Z","repository":{"id":21660377,"uuid":"92855138","full_name":"javascript-studio/studio-ndjson","owner":"javascript-studio","description":"☯️ Transforms to parse and stringify ndjson","archived":false,"fork":false,"pushed_at":"2024-01-11T10:35:34.000Z","size":1049,"stargazers_count":2,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T15:51:53.807Z","etag":null,"topics":["json","ndjson","parse","stream","stringify","transform"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/javascript-studio.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-05-30T16:46:51.000Z","updated_at":"2022-02-02T08:10:36.000Z","dependencies_parsed_at":"2024-01-11T12:43:05.863Z","dependency_job_id":"b4e67229-7ed7-4bbd-9d4a-b934dbf56dac","html_url":"https://github.com/javascript-studio/studio-ndjson","commit_stats":{"total_commits":42,"total_committers":2,"mean_commits":21.0,"dds":"0.23809523809523814","last_synced_commit":"c307b9858c17c4c606594af9cf056081bd339261"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javascript-studio%2Fstudio-ndjson","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javascript-studio%2Fstudio-ndjson/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javascript-studio%2Fstudio-ndjson/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javascript-studio%2Fstudio-ndjson/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/javascript-studio","download_url":"https://codeload.github.com/javascript-studio/studio-ndjson/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248809038,"owners_count":21164893,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["json","ndjson","parse","stream","stringify","transform"],"created_at":"2025-03-27T15:38:03.333Z","updated_at":"2025-04-14T01:40:22.133Z","avatar_url":"https://github.com/javascript-studio.png","language":"JavaScript","readme":"# Studio ndjson\n\n☯️ Transforms to parse and stringify [ndjson][1].\n\n\u003e This module also works in the browser using a [naive `stream` shim][4] for\n\u003e small Browserify bundles.\n\n## Usage\n\nTo stringify an object stream into ndjson:\n\n```js\nconst StringifyTransform = require('@studio/ndjson/stringify');\n\nobject_stream.pipe(new StringifyTransform()).pipe(process.stdout);\n```\n\nTo parse ndjson into an object stream:\n\n```js\nconst ParseTransform = require('@studio/ndjson/parse');\n\nprocess.stdin.pipe(new ParseTransform()).pipe(object_stream);\n```\n\n## Install\n\n```bash\n❯ npm i @studio/ndjson\n```\n\n## API\n\nRequire the transform you need:\n\n- `@studio/ndjson/stringify`: Exports the `StringifyTransform` class which\n  reads objects and writes strings.\n- `@studio/ndjson/parse`: Exports the `ParseTransform` class which reads\n  strings and writes objects.\n\nThe module main exports `StringifyTransform` and `ParseTransform` if you need\nboth:\n\n```js\nconst { StringifyTransform, ParseTransform } = require('@studio/ndjson');\n```\n\n### ParseTransform options\n\nThe `ParseTransform` constructor accepts an `options` object with these\nproperties:\n\n- `loose`: Whether to ignore data before the first `{` in each line.\n- `loose_out`: A stream to receive data that was found before the first `{` in\n  each line. Implies `loose`.\n\n### Error handling\n\nIf `JSON.parse` or `JSON.stringify` throw an error, the transform emits an\n`error` event with the error object having a `code` property with\n`ERR_JSON_PARSE` or `ERR_JSON_STRINGIFY`. For parse errors, the `line` property\non the error is the string that could not be parsed.\n\n## Related modules\n\n- 👻 [Studio Log][2]: This module was refactored out of the logger for\n  [JavaScript Studio][3].\n- 💧 [Studio Browser Stream][4] is a naive `stream` shim for small Browserify\n  bundles.\n- 📦 [Studio Changes][5] is used to create the changelog for this module.\n\n## License\n\nMIT\n\n\u003cdiv align=\"center\"\u003eMade with ❤️ on 🌍\u003c/div\u003e\n\n[1]: http://ndjson.org/\n[2]: https://github.com/javascript-studio/studio-log\n[3]: https://javascript.studio\n[4]: https://github.com/javascript-studio/studio-browser-stream\n[5]: https://github.com/javascript-studio/studio-changes\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjavascript-studio%2Fstudio-ndjson","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjavascript-studio%2Fstudio-ndjson","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjavascript-studio%2Fstudio-ndjson/lists"}