{"name":"json-text-sequence","version":"4.0.2","keywords":["json","sequence","stream","RS"],"author":{"name":"Joe Hildebrand"},"license":"MIT","_id":"json-text-sequence@4.0.2","maintainers":[{"name":"hildjj","email":"joe-github@cursive.net"}],"homepage":"https://github.com/hildjj/json-text-sequence","bugs":{"url":"https://github.com/hildjj/json-text-sequence/issues"},"dist":{"shasum":"31cc1c0c4274beb841ba389665c824b2da77aeee","tarball":"http://registry-npm.ywwl.com/json-text-sequence/download/json-text-sequence-4.0.2.tgz","fileCount":5,"integrity":"sha512-rpmhNYEvL5LEAK0QNhgs+mOCyIh5tfiEQC59Wf3huR4wXcmJHBnSEc6pWqNPR/cjHoSgDhTEfbHqAh7gqaNbiw==","signatures":[{"sig":"MEYCIQDvjzfrgXvOLQew0MBT1hr837Z0EnWxUt7nCe1GSPaD1gIhAMM1hkpzHdFBPEVL/7vehsFL6cLcPLG0JCyk2LhvDucY","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/json-text-sequence@4.0.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":7767,"size":3362,"noattachment":false,"key":"/json-text-sequence/-/json-text-sequence-4.0.2.tgz"},"main":"./lib/index.js","type":"module","types":"types/index.d.ts","engines":{"node":">=20"},"gitHead":"337c7baeb5318785492b50930f7a1850f3452a65","_npmUser":{"name":"hildjj","email":"joe-github@cursive.net"},"repository":{"url":"git+https://github.com/hildjj/json-text-sequence.git","type":"git"},"_npmVersion":"10.9.2","description":"Parse and generate RS-delimited JSON sequences according to draft-ietf-json-text-sequence","directories":{},"_nodeVersion":"22.17.1","dependencies":{"@sovpro/delimited-stream":"^1.1.0"},"_hasShrinkwrap":false,"packageManager":"pnpm@10.14.0","_npmOperationalInternal":{"tmp":"tmp/json-text-sequence_4.0.2_1754280750954_0.7446422691201462","host":"s3://npm-registry-packages-npm-production"},"readme":"# json-text-sequence\n\nParse and generate JSON text sequences as defined in [RFC 7464](https://tools.ietf.org/html/rfc7464).\n\nJSON text sequences are nice for unambiguous JSON log files.  They are resilient\nto many forms of damage such as truncation, multiple writers incorrectly\nconfigured to write to the same file, corrupted JSON, etc.  An example sequence:\n\n    ␞{\"d\":\"2014-09-22T21:58:35.270Z\",\"value\":6}␤\n    ␞{\"d\":\"2014-09-22T21:59:15.117Z\",\"value\":12}␤\n\nWhere \"␞\" is the ASCII \"Record Separator\" character (U+001E), and \"␤\" is the\nASCII \"LINE FEED\" character (U+000A), otherwise known as \"\\n\".\n\n## Installation\n\n    npm install json-text-sequence\n\n## API\n\n### Parsing\n\nTo parse the format, pipe an input source into a parser stream:\n\n```js\nimport {Parser} from 'json-text-sequence'\nimport fs from 'fs'\n\nconst p = new Parser()\n  .on('data', obj => {\n    console.log('JSON:', obj);\n  })\n  .on('truncated', buf => {\n    console.log('Truncated:', buf);\n  })\n  .on('invalid', buf => {\n    console.log('Invalid:', buf);\n  })\n  .on('finish', () => {\n    console.log('DONE');\n  });\n\nfs.createReadStream('example.log').pipe(p);\n```\n\n### Generation\n\nTo generate the format, create a generator, pipe its output somewhere\ninteresting, then write objects to the generator:\n\n```js\nimport {Generator} from 'json-text-sequence'\nimport fs from 'fs'\n\nconst g = new Generator();\ng.pipe(fs.createWriteStream('example.log'));\n\ng.write({\n  d: new Date(),\n  count: 0\n});\n```\n\n---\n[![Tests](https://github.com/hildjj/json-text-sequence/workflows/Tests/badge.svg)](https://github.com/hildjj/json-text-sequence/actions?query=workflow%3ATests)\n[![codecov](https://codecov.io/gh/hildjj/json-text-sequence/graph/badge.svg?token=eBBBlbwJLl)](https://codecov.io/gh/hildjj/json-text-sequence)\n","publish_time":1754280751124,"_cnpm_publish_time":1754280751124,"dist-tags":{"latest":"5.0.1"}}