Gathering detailed insights and metrics for @ssttevee/cfw-formdata-polyfill
Gathering detailed insights and metrics for @ssttevee/cfw-formdata-polyfill
Gathering detailed insights and metrics for @ssttevee/cfw-formdata-polyfill
Gathering detailed insights and metrics for @ssttevee/cfw-formdata-polyfill
npm install @ssttevee/cfw-formdata-polyfill
Typescript
Module System
Node Version
NPM Version
75.5
Supply Chain
74.6
Quality
74.8
Maintenance
100
Vulnerability
100
License
JavaScript (69.13%)
TypeScript (30.87%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
28 Stars
6 Commits
2 Forks
1 Watchers
1 Branches
2 Contributors
Updated on Feb 23, 2025
Latest Version
0.2.1
Package Id
@ssttevee/cfw-formdata-polyfill@0.2.1
Unpacked Size
5.89 kB
Size
2.82 kB
File Count
6
NPM Version
6.10.2
Node Version
12.9.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
4
1
A polyfill for Request.prototype.formData
on cloudflare workers because they're not compliant to the whatwg spec even though their documentation suggests otherwise.
1npm install @ssttevee/cfw-formdata-polyfill
1import `@ssttevee/cfw-formdata-polyfill`; 2 3// get req from handler 4 5const fd = await req.formData();
or if a ponyfill is more preferrable
1import FormDataFromRequest from '@ssttevee/cfw-formdata-polyfill/ponyfill'; 2 3// get req from handler 4 5const fd = await FormDataFromRequest.call(req);
There are some full examples in the examples directory.
Request.prototype.formData
on Cloudflare WorkersSince before the public launch of Cloudflare Workers until the time of writing, Request.prototype.formData
has been able to handle application/x-www-form-urlencoded
payloads as one would expect. However, their support for multipart/form-data
has been... undocumented.
multipart/form-data
supportThe native Request.prototype.formData
does technically support multipart/form-data
. However, files are returned as binary strings rather than a Blob. That means the filename and content type metadata is lost. Though this is somewhat justified upon closer inspection of the environment.
The FormData API, as long as no files are involved, seems to work as one would expect. However, advanced users will quickly realize that it cannot be used to construct multipart/form-data
payloads to be used with fetch
. It doesn't even accept any type other than strings. This is because the Blob API doesn't exist on Cloudflare Workers.
The Blob API, as designed for the browser, is meant to be an abstraction for reading arbitrary data, outside of the browser sandbox, from the operating system. Meanwhile, there is no parallel in the Cloudflare Workers environment. This, I believe, is the primary reason that this halfway point for the FormData API exists on Cloudflare Workers.
This package was designed to be used in conjuction with a bundler -- I prefer rollup -- to fix Request.prototype.formData
and to be able to use it for receiving multipart/form-data
uploads.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
Found 1/4 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More