{"id":22158873,"url":"https://github.com/jlarmstrongiv/tfjs-node-lambda","last_synced_at":"2025-08-12T16:39:22.970Z","repository":{"id":50489864,"uuid":"316958719","full_name":"jlarmstrongiv/tfjs-node-lambda","owner":"jlarmstrongiv","description":"Loadable @tensorflow/tfjs-node compiled for lambda.  Avoid native module errors and package size limits.","archived":false,"fork":false,"pushed_at":"2023-12-15T14:51:19.000Z","size":789,"stargazers_count":8,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-20T11:51:15.408Z","etag":null,"topics":["lambda","nodejs","tensorflow"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/tfjs-node-lambda","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/jlarmstrongiv.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-11-29T13:36:25.000Z","updated_at":"2022-12-25T20:09:01.000Z","dependencies_parsed_at":"2023-02-01T17:01:36.774Z","dependency_job_id":"170f5f36-168d-4049-8dc9-6af198a08d50","html_url":"https://github.com/jlarmstrongiv/tfjs-node-lambda","commit_stats":{"total_commits":200,"total_committers":3,"mean_commits":66.66666666666667,"dds":"0.44499999999999995","last_synced_commit":"1c1226f8adaf25e85e08fa0e0d7273736e1402eb"},"previous_names":[],"tags_count":53,"template":false,"template_full_name":null,"purl":"pkg:github/jlarmstrongiv/tfjs-node-lambda","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlarmstrongiv%2Ftfjs-node-lambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlarmstrongiv%2Ftfjs-node-lambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlarmstrongiv%2Ftfjs-node-lambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlarmstrongiv%2Ftfjs-node-lambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jlarmstrongiv","download_url":"https://codeload.github.com/jlarmstrongiv/tfjs-node-lambda/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jlarmstrongiv%2Ftfjs-node-lambda/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270099142,"owners_count":24527027,"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-12T02:00:09.011Z","response_time":80,"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":["lambda","nodejs","tensorflow"],"created_at":"2024-12-02T03:39:08.122Z","updated_at":"2025-08-12T16:39:22.932Z","avatar_url":"https://github.com/jlarmstrongiv.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tfjs-node-lambda\n\n## Why\n\nIt is difficult to run tensorflow in a lambda:\n\n- Size constraints from the lambda environment (\u003c50MB)\n- Native code compilation for the lambda environment\n\nThis family of packages will handle that heavy lifting for you.\n\n## Versions\n\nSee the GitHub [repository](https://github.com/jlarmstrongiv/tfjs-node-lambda/blob/main/matrix.json) for version information. This package will always contain a matrix of the currently supported AWS Lambda Node environments and the `@tensorflow/tfjs-node` latest major versions.\n\nExample matrix:\n\n```json\n{\n  \"lambda\": [\"nodejs10.x\", \"nodejs12.x\", \"nodejs14.x\"],\n  \"tensorflow\": [\"1.7.4\", \"2.8.6\", \"3.6.1\"]\n}\n```\n\nExample releases:\n\n```\nnodejs10.x-tf1.7.4.br\nnodejs10.x-tf2.8.6.br\nnodejs10.x-tf3.6.1.br\n\nnodejs12.x-tf1.7.4.br\nnodejs12.x-tf2.8.6.br\nnodejs12.x-tf3.6.1.br\n\nnodejs14.x-tf1.7.4.br\nnodejs14.x-tf2.8.6.br\nnodejs14.x-tf3.6.1.br\n```\n\nUsing GitHub actions, these versions are updated daily around midnight. Lock your versions with the `--save-exact` flag.\n\n\u003c!-- Double check `tfjs-node-lambda` and `tfjs-node-lambda-releases` are the same matching versions. --\u003e\n\n## Installation\n\n```bash\nnpm install --save --save-exact tfjs-node-lambda tfjs-node-lambda-helpers\nnpm install --save-dev --save-exact @tensorflow/tfjs-node @tensorflow/tfjs\n```\n\n\u003c!-- tfjs-node-lambda-releases --\u003e\n\n### Related libraries\n\n- [tfjs-node-lambda](https://www.npmjs.com/package/tfjs-node-lambda)\n- [tfjs-node-lambda-helpers](https://www.npmjs.com/package/tfjs-node-lambda-helpers)\n- [@tensorflow/tfjs-node](https://www.npmjs.com/package/@tensorflow/tfjs-node)\n- [@tensorflow/tfjs](https://www.npmjs.com/package/@tensorflow/tfjs)\n\n## tfjs-node-lambda\n\n```ts\nimport loadTf from 'tfjs-node-lambda';\nconst tf: typeof import('@tensorflow/tfjs') = await loadTf(readStream);\n```\n\nThe [`tfjs-node-lambda-helpers`](https://www.npmjs.com/package/tfjs-node-lambda-helpers) can help determine environments, generate release urls, download releases, and avoid timeouts. If you would prefer to have full control, see the readStream examples below.\n\n#### readStream\n\nIn development, `loadTf` will run your locally installed version of `@tensorflow/tfjs-node`. If running in an AWS Lambda environment, `loadTf` expects a readStream of the release:\n\n```ts\nimport { Readable } from 'stream';\n\nconst response = await axios.get(\n  'https://github.com/jlarmstrongiv/tfjs-node-lambda/releases/download/v2.0.10/nodejs12.x-tf2.8.6.br',\n  { responseType: 'arraybuffer' },\n);\n\nconst readStream = Readable.from(response.data);\n```\n\nOr, if you have saved the file to the tmp directory:\n\n```ts\nimport os from 'os';\nimport path from 'path';\n\nconst readStream = fs.createReadStream(\n  path.join(os.tmpdir(), 'nodejs12.x-tf2.8.6.br'),\n);\n```\n\n#### JavaScript\n\n```js\nconst tf = await loadTf(readStream);\n```\n\n#### TypeScript\n\nDue to having multiple supported versions of `@tensorflow/tfjs-node` and an irregular bundle method, you must specify the types:\n\n```ts\nconst tf: typeof import('@tensorflow/tfjs') = await loadTf(readStream);\n```\n\n## Contributing\n\nWe welcome contributions!\n\nInspired by and originally forked from Luc Leray’s [tensorflow-lambda](https://www.npmjs.com/package/tensorflow-lambda).\n\n†[tfjs-node-lambda-releases](https://www.npmjs.com/package/tfjs-node-lambda-releases) is soft deprecated. Due to file size limitations, 6 releases are too big to be published on npm. Use the assets on [GitHub Releases](https://github.com/jlarmstrongiv/tfjs-node-lambda/releases) instead.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjlarmstrongiv%2Ftfjs-node-lambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjlarmstrongiv%2Ftfjs-node-lambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjlarmstrongiv%2Ftfjs-node-lambda/lists"}