
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
node-streamable-file
Advanced tools
ℹ️ This implementation is for Node.js prior to 19.8. For 19.8 or newer, please use fs.openAsBlob.
This repo contains a convenience function for creating a File object that can be appended by FormData and uploaded via Fetch using a 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 will result in an ERR_FS_FILE_TOO_LARGE error. The implementation in this repo was inspired by this StackOverflow post.
Install this package
npm i node-streamable-file
If you're using Node.js prior to 18.13, you'll also need to install a polyfill for File.
npm i @web-std/file
Import createStreamableFile from node-streamable-file and open from node:fs/promises.
import { createStreamableFile } from 'node-streamable-file';
import { open } from 'node:fs/promises';
Call 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.
const path = 'path/to/file.txt';
const name = basename(path);
const handle = await open(path);
const file = await createStreamableFile(name, handle);
const formData = new FormData();
formData.append('file', file, name);
await fetch(url, {
method: 'POST',
body: formData
});
await handle.close();
You might run into the following
Argument of type 'File' is not assignable to parameter of type 'Blob'
This issue is a result of a bug in TypeScript. You can read more about it here and here. You can silence this error by casting to unknown and then to Blob.
formData.append('file', file as unknown as Blob);
Alternatively, the warning can be fixed by setting "skipLibCheck": true, in your tsconfig.json file.
BugSplat is a software crash and error reporting service with support for Node.js, Electron, Web 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.
FAQs
Cross platform symbol upload tool
We found that node-streamable-file demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.