{"id":17664440,"url":"https://github.com/tilfin/kinesis-stream-lambda","last_synced_at":"2025-07-22T04:06:02.166Z","repository":{"id":143882458,"uuid":"67353989","full_name":"tilfin/kinesis-stream-lambda","owner":"tilfin","description":"Readable stream in Lambda for Kinesis Stream","archived":false,"fork":false,"pushed_at":"2018-11-28T15:25:31.000Z","size":33,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-11T06:11:57.097Z","etag":null,"topics":["kinesis-stream","kpl-aggregation","lambda","nodejs","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/tilfin.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2016-09-04T15:48:11.000Z","updated_at":"2018-11-28T15:24:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"8264e950-60b9-4c49-8a5a-f2bd5a965a31","html_url":"https://github.com/tilfin/kinesis-stream-lambda","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/tilfin/kinesis-stream-lambda","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tilfin%2Fkinesis-stream-lambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tilfin%2Fkinesis-stream-lambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tilfin%2Fkinesis-stream-lambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tilfin%2Fkinesis-stream-lambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tilfin","download_url":"https://codeload.github.com/tilfin/kinesis-stream-lambda/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tilfin%2Fkinesis-stream-lambda/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266424179,"owners_count":23926126,"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-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"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":["kinesis-stream","kpl-aggregation","lambda","nodejs","stream"],"created_at":"2024-10-23T20:05:26.397Z","updated_at":"2025-07-22T04:06:02.139Z","avatar_url":"https://github.com/tilfin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"kinesis-stream-lambda\n=====================\n\n[![NPM Version][npm-image]][npm-url]\n[![Node](https://img.shields.io/node/v/kinesis-stream-lambda.svg)]()\n[![Build Status](https://travis-ci.org/tilfin/kinesis-stream-lambda.svg?branch=master)](https://travis-ci.org/tilfin/kinesis-stream-lambda)\n[![Coverage Status](https://coveralls.io/repos/github/tilfin/kinesis-stream-lambda/badge.svg?branch=master)](https://coveralls.io/github/tilfin/kinesis-stream-lambda?branch=master)\n[![dependencies Status](https://david-dm.org/tilfin/kinesis-stream-lambda/status.svg)](https://david-dm.org/tilfin/kinesis-stream-lambda)\n\n## Features\n\n* Easily reads a Lambda event of Kinesis Stream as a stream handling the chunk as Buffer\n* Supports KPL aggregation (set opts.isAgg true)\n* Provides KSL.parseJSON transform to handle items expanded array data in one record (set opts.flatArray true)\n* Node.js 6.10 or Later\n\n## How to install\n\n```\n$ npm install -save kinesis-stream-lambda\n```\n\n### KPL aggregation only\n\nfurthermore,\n\n```\n$ npm install -save aws-kinesis-agg\n```\n\n## Lambda handler examples\n\n### async/await style\n\n```javascript\nconst StreamUtils = require('@tilfin/stream-utils');\nconst KSL = require('kinesis-stream-lambda');\nconst PromisedLife = require('promised-lifestream');\n\nexports.handler = async function (event) {\n  console.log('event: ', JSON.stringify(event, null, 2));\n\n  const result = [];\n\n  await PromisedLife([\n    KSL.reader(event, { isAgg: false }),\n    KSL.parseJSON({ flatArray: false }),\n    StreamUtils.map(function(data, cb) {\n      result.push(data);\n      cb(null, data)\n    })\n  ])\n\n  console.dir(result);\n}\n```\n\n### normal style\n\n```javascript\nconst StreamUtils = require('@tilfin/stream-utils');\nconst KSL = require('kinesis-stream-lambda');\n\nexports.handler = function (event, context, callback) {\n  console.log('event: ', JSON.stringify(event, null, 2));\n\n  const result = [];\n  const stream = KSL.reader(event, { isAgg: false });\n\n  stream.on('end', () =\u003e {\n    console.dir(result);\n    callback();\n  });\n\n  stream.on('error', err =\u003e {\n    callback(err);\n  });\n\n  stream\n  .pipe(KSL.parseJSON({ flatArray: false }))\n  .pipe(StreamUtils.map(function(data, cb) {\n    result.push(data);\n    cb(null, data)\n  }));\n}\n```\n\n## License\n\n  [MIT](LICENSE)\n\n[npm-image]: https://img.shields.io/npm/v/kinesis-stream-lambda.svg\n[npm-url]: https://npmjs.org/package/kinesis-stream-lambda\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftilfin%2Fkinesis-stream-lambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftilfin%2Fkinesis-stream-lambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftilfin%2Fkinesis-stream-lambda/lists"}