{"id":22808057,"url":"https://github.com/lifion/lifion-aws-event-stream","last_synced_at":"2025-08-20T10:16:31.797Z","repository":{"id":33059305,"uuid":"150770699","full_name":"lifion/lifion-aws-event-stream","owner":"lifion","description":"Node.js parser for the application/vnd.amazon.eventstream content-type.","archived":false,"fork":false,"pushed_at":"2023-01-10T21:02:52.000Z","size":1806,"stargazers_count":0,"open_issues_count":14,"forks_count":0,"subscribers_count":6,"default_branch":"develop","last_synced_at":"2025-08-09T09:53:57.908Z","etag":null,"topics":["amazon-event-stream","aws","aws-event-stream","cloud","content-type","event-stream","node","nodejs","parser","stream"],"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/lifion.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-28T17:00:51.000Z","updated_at":"2021-10-08T01:23:35.000Z","dependencies_parsed_at":"2023-01-14T23:13:39.363Z","dependency_job_id":null,"html_url":"https://github.com/lifion/lifion-aws-event-stream","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/lifion/lifion-aws-event-stream","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lifion%2Flifion-aws-event-stream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lifion%2Flifion-aws-event-stream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lifion%2Flifion-aws-event-stream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lifion%2Flifion-aws-event-stream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lifion","download_url":"https://codeload.github.com/lifion/lifion-aws-event-stream/tar.gz/refs/heads/develop","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lifion%2Flifion-aws-event-stream/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":271301318,"owners_count":24735752,"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","status":"online","status_checked_at":"2025-08-20T02:00:09.606Z","response_time":69,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["amazon-event-stream","aws","aws-event-stream","cloud","content-type","event-stream","node","nodejs","parser","stream"],"created_at":"2024-12-12T11:07:48.724Z","updated_at":"2025-08-20T10:16:31.742Z","avatar_url":"https://github.com/lifion.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# lifion-aws-event-stream\n\nNode.js parser for binary streams under the **application/vnd.amazon.eventstream** content-type.\n\n## Getting Started\n\nTo install the module:\n\n```sh\nnpm install lifion-aws-event-stream --save\n```\n\nThe module exports a [parse](#module_lifion-aws-event-stream.parse) function and a [Parser](#module_lifion-aws-event-stream.Parser) stream. To use the [parse](#module_lifion-aws-event-stream.parse) function:\n\n```js\nconst { parse } = require('lifion-aws-event-stream');\n\nconst buffer = Buffer.from('000000100000000005c248eb7d98c8ff', 'hex');\nconsole.log(parse(buffer)); // { headers: {}, payload: '' }\n```\n\nTo use the [Parser](#module_lifion-aws-event-stream.Parser) stream:\n\n```js\nconst { Parser } = require('lifion-aws-event-stream');\n\nconst parser = new Parser();\nparser.on('data', console.log); // { headers: {}, payload: '' }\n\nconst buffer = Buffer.from('000000100000000005c248eb7d98c8ff', 'hex');\nparser.write(buffer);\n```\n\nPipe an HTTP response to parse the messages as they arrive:\n\n```js\nconst got = require('got');\nconst { Parser } = require('lifion-aws-event-stream');\nconst { pipeline } = require('stream');\n\npipeline([\n  got('/', …),\n  new Parser(),\n  new Writable({\n    objectMode: true,\n    write(data, encoding, callback) {\n      console.log(data);\n      callback();\n    }\n  }),\n]);\n```\n\nThis project's implementation is based on:\n\n- https://github.com/aws/aws-sdk-ruby/tree/master/gems/aws-eventstream\n- https://github.com/awslabs/aws-c-event-stream\n\n## API Reference\n\n\n* [lifion-aws-event-stream](#module_lifion-aws-event-stream)\n    * _global_\n        * [Parser](#Parser) ⇐ \u003ccode\u003eTransform\u003c/code\u003e\n    * _static_\n        * [.parse(buffer)](#module_lifion-aws-event-stream.parse) ⇒ \u003ccode\u003eObject\u003c/code\u003e\n\n\u003ca name=\"Parser\"\u003e\u003c/a\u003e\n\n### lifion-aws-event-streamParser ⇐ \u003ccode\u003eTransform\u003c/code\u003e\nA transform stream that calls parse with the binary data written to it. Can be used to pipe\na response stream from an AWS service HTTP request. The stream will emit errors thrown during\nparse calls.\n\n**Kind**: global class of [\u003ccode\u003elifion-aws-event-stream\u003c/code\u003e](#module_lifion-aws-event-stream)  \n**Extends**: \u003ccode\u003eTransform\u003c/code\u003e  \n**See**: https://nodejs.org/dist/latest-v10.x/docs/api/stream.html#stream_class_stream_transform  \n\u003ca name=\"module_lifion-aws-event-stream.parse\"\u003e\u003c/a\u003e\n\n### eventStream.parse(buffer) ⇒ \u003ccode\u003eObject\u003c/code\u003e\nParses the specified buffer with vnd.amazon.eventstream data into an object.\n\n**Kind**: static method of [\u003ccode\u003elifion-aws-event-stream\u003c/code\u003e](#module_lifion-aws-event-stream)  \n**Returns**: \u003ccode\u003eObject\u003c/code\u003e - The parsed vnd.amazon.eventstream object.  \n**Throws**:\n\n- \u003ccode\u003eError\u003c/code\u003e Whenever:\n  - The specified buffer has less than 16 bytes. The minimum vnd.amazon.eventstream message\n    should have 4 bytes for the total length of the package, 4 bytes for the length of the\n    headers section, 4 bytes for the checksum of the prelude, and finally 4 more bytes for\n    the checksum of the entire message.\n  - The total length as specified in the message doesn't matches the bufffer length.\n  - The checksum of the prelude doesn't matches the calculated checksum.\n  - The checksum of the message doesn't matches the calculated checksum.\n  - The header value type is unknown.\n\n\n| Param | Type | Description |\n| --- | --- | --- |\n| buffer | \u003ccode\u003eBuffer\u003c/code\u003e | The buffer to parse. |\n\n\n## License\n\n[MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flifion%2Flifion-aws-event-stream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flifion%2Flifion-aws-event-stream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flifion%2Flifion-aws-event-stream/lists"}