{"id":25836016,"url":"https://github.com/bugsplat-git/node-streamable-file","last_synced_at":"2026-06-12T15:31:51.878Z","repository":{"id":190043102,"uuid":"681833401","full_name":"BugSplat-Git/node-streamable-file","owner":"BugSplat-Git","description":"🌐📚🌊 Node.js FormData compatible File object via ReadableStreams","archived":false,"fork":false,"pushed_at":"2023-09-06T00:32:57.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-11-23T18:24:44.816Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/BugSplat-Git.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-08-22T21:25:54.000Z","updated_at":"2023-08-22T23:38:07.000Z","dependencies_parsed_at":null,"dependency_job_id":"ff16a4b1-23cd-4ad8-b393-158f0ec6f076","html_url":"https://github.com/BugSplat-Git/node-streamable-file","commit_stats":null,"previous_names":["bugsplat-git/node-streamable-file"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/BugSplat-Git/node-streamable-file","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BugSplat-Git%2Fnode-streamable-file","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BugSplat-Git%2Fnode-streamable-file/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BugSplat-Git%2Fnode-streamable-file/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BugSplat-Git%2Fnode-streamable-file/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BugSplat-Git","download_url":"https://codeload.github.com/BugSplat-Git/node-streamable-file/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BugSplat-Git%2Fnode-streamable-file/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34251774,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-12T02:00:06.859Z","response_time":109,"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":[],"created_at":"2025-03-01T01:38:52.372Z","updated_at":"2026-06-12T15:31:51.873Z","avatar_url":"https://github.com/BugSplat-Git.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![bugsplat-github-banner-basic-outline](https://user-images.githubusercontent.com/20464226/149019306-3186103c-5315-4dad-a499-4fd1df408475.png)](https://bugsplat.com)\n\u003cbr/\u003e\n# \u003cdiv align=\"center\"\u003eBugSplat\u003c/div\u003e \n### **\u003cdiv align=\"center\"\u003eCrash and error reporting built for busy developers.\u003c/div\u003e**\n\u003cdiv align=\"center\"\u003e\n    \u003ca href=\"https://twitter.com/BugSplatCo\"\u003e\n        \u003cimg alt=\"Follow @bugsplatco on Twitter\" src=\"https://img.shields.io/twitter/follow/bugsplatco?label=Follow%20BugSplat\u0026style=social\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://discord.gg/bugsplat\"\u003e\n        \u003cimg alt=\"Join BugSplat on Discord\" src=\"https://img.shields.io/discord/664965194799251487?label=Join%20Discord\u0026logo=Discord\u0026style=social\"\u003e\n    \u003c/a\u003e\n\u003c/div\u003e\n\n\u003cbr/\u003e\n\n\u003e ℹ️ This implementation is for Node.js prior to 19.8. For 19.8 or newer, please use [fs.openAsBlob](https://nodejs.org/api/fs.html#fsopenasblobpath-options).\n\n# node-streamable-file\n\nThis repo contains a convenience function for creating a [File](https://developer.mozilla.org/en-US/docs/Web/API/File) object that can be appended by [FormData](https://developer.mozilla.org/en-US/docs/Web/API/FormData) and uploaded via [Fetch](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API) using a [ReadableStream](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream). Node.js has a maximum https://nodejs.org/api/buffer.html size of 2 GB. Uploading files that are larger than the [maximum Buffer size](https://nodejs.org/api/buffer.html#bufferconstantsmax_length) will result in an [ERR_FS_FILE_TOO_LARGE](https://nodejs.org/api/errors.html#err_fs_file_too_large) error. The implementation in this repo was inspired by this [StackOverflow](https://stackoverflow.com/a/76026397/2993077) post.\n\n## ⚙️ Installation\n\nInstall this package\n\n```bash\nnpm i node-streamable-file\n```\n\nIf you're using Node.js prior to 18.13, you'll also need to install a polyfill for [File](https://nodejs.org/dist/latest-v20.x/docs/api/buffer.html#new-bufferfilesources-filename-options).\n\n```bash\nnpm i @web-std/file\n```\n\n## 🧑‍💻 Usage\n\nImport `createStreamableFile` from `node-streamable-file` and `open` from `node:fs/promises`.\n\n```ts\nimport { createStreamableFile } from 'node-streamable-file';\nimport { open } from 'node:fs/promises';\n```\n\nCall `open` with the path to your file to create a `FileHandle` and pass it to `createStreamableFile`. The result of `createStreamableFile` can be appended to a `FormData` object and uploaded via `Fetch`. Be sure to call `handle.close` when you're done with the file.\n\n```ts\nconst path = 'path/to/file.txt';\nconst name = basename(path);\nconst handle = await open(path);\nconst file = await createStreamableFile(name, handle);\n\nconst formData = new FormData();\nformData.append('file', file, name);\n\nawait fetch(url, {\n  method: 'POST',\n  body: formData\n});\n\nawait handle.close();\n```\n\n## 💥 Known Issues\n\nYou might run into the following \n\n```\nArgument of type 'File' is not assignable to parameter of type 'Blob'\n```\n\nThis issue is a result of a bug in TypeScript. You can read more about it [here](https://github.com/microsoft/TypeScript/issues/52166) and [here](https://github.com/remix-run/remix/issues/4371). You can silence this error by casting to `unknown` and then to `Blob`.\n\n```ts\nformData.append('file', file as unknown as Blob);\n```\n\nAlternatively, the warning can be fixed by setting `\"skipLibCheck\": true,` in your `tsconfig.json` file.\n\n## 🐛 About\n\n[BugSplat](https://bugsplat.com) is a software crash and error reporting service with support for [Node.js](https://docs.bugsplat.com/introduction/getting-started/integrations/cross-platform/node.js), [Electron](https://docs.bugsplat.com/introduction/getting-started/integrations/cross-platform/electron), [Web](https://docs.bugsplat.com/introduction/getting-started/integrations/web/javascript) applications, and many more. BugSplat automatically captures critical diagnostic data such as stack traces, log files, and other runtime information. BugSplat also provides automated incident notifications, a convenient dashboard for monitoring trends and prioritizing engineering efforts, and integrations with popular development tools to maximize productivity and ship more profitable software.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbugsplat-git%2Fnode-streamable-file","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbugsplat-git%2Fnode-streamable-file","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbugsplat-git%2Fnode-streamable-file/lists"}