Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ at Twitter.
This project is [semantically versioned](https://semver.org) and if you want support in migrating between versions you can schedule us for training or support us through donations, so we can prioritize.

> [!CAUTION]
> As of April 2025, old versions like v1 and v2 are still the most used, while they are deperecated for years -- they are also vulnerable to attacks if you are not implementing it properly. **Please upgrade!** We are here to help, and AI Editors & Agents could help a lot in such codemod-like migrations.
> As of April 2025, old versions like v1 and v2 are still the most used, while they are deprecated for years -- they are also vulnerable to attacks if you are not implementing it properly. **Please upgrade!** We are here to help, and AI Editors & Agents could help a lot in such codemod-like migrations.

> [!TIP]
> If you are starting a fresh project, you can check out the `formidable-mini` which is a super minimal version of Formidable (not quite configurable yet, but when it does it could become the basis for `formidable@v4`), using web standards like FormData API and File API, and you can use it to stream uploads directly to S3 or other such services.
Expand Down Expand Up @@ -322,7 +322,7 @@ See it's defaults in [src/Formidable.js DEFAULT_OPTIONS](./src/Formidable.js)
extensions of the original files or not
- `options.allowEmptyFiles` **{boolean}** - default `false`; allow upload empty
files
- `options.minFileSize` **{number}** - default `1` (1byte); the minium size of
- `options.minFileSize` **{number}** - default `1` (1byte); the minimum size of
uploaded file.
- `options.maxFiles` **{number}** - default `Infinity`;
limit the amount of uploaded files, set Infinity for unlimited
Expand Down
2 changes: 1 addition & 1 deletion benchmark/server.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// inital copy of with-http.js
// initial copy of with-http.js
// made a copy so that examples can be changed without impacting tests
import http from 'node:http';
import slugify from '@sindresorhus/slugify';
Expand Down
6 changes: 3 additions & 3 deletions examples/forceBuffer.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// warning: forcing file into a Buffer elminates the benefits of using streams and may cause memory overflow
// warning: forcing file into a Buffer eliminates the benefits of using streams and may cause memory overflow
import http from 'node:http';
import { Buffer } from 'node:buffer'
import { Writable } from 'node:stream';
Expand All @@ -12,10 +12,10 @@ const server = http.createServer((req, res) => {
const form = formidable({
fileWriteStreamHandler: (file) => {
const chunks = [];

const writable = new Writable({
write (chunk, enc, next) {
chunks.push(chunk);
chunks.push(chunk);
next();
},
destroy() {
Expand Down
6 changes: 3 additions & 3 deletions examples/with-http.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ const server = http.createServer((req, res) => {
if (!originalFilename) {
return 'invalid';
}
// return 'yo.txt'; // or completly different name

// return 'yo.txt'; // or completely different name
// return 'z/yo.txt'; // subdirectory
return originalFilename.split("/").map((subdir) => {
return slugify(subdir, {separator: ''}); // slugify to avoid invalid filenames
}).join("/").substr(0, 100); // substr to define a maximum
}).join("/").substr(0, 100); // substr to define a maximum
},
filter: function ({name, originalFilename, mimetype}) {
return Boolean(originalFilename);
Expand Down