Skip to content

Commit 9d6c76a

Browse files
committed
chore: updare readme
Signed-off-by: tunnckoCore <[email protected]>
1 parent 1f33763 commit 9d6c76a

File tree

3 files changed

+44
-38
lines changed

3 files changed

+44
-38
lines changed

README.md

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,33 @@
77
> A Node.js module for parsing form data, especially file uploads.
88
99
[![Code style][codestyle-img]][codestyle-url]
10-
[![codecoverage][codecov-img]][codecov-url]
10+
<!-- [![codecoverage][codecov-img]][codecov-url] -->
1111
[![linux build status][linux-build-img]][build-url]
1212
[![windows build status][windows-build-img]][build-url]
1313
[![macos build status][macos-build-img]][build-url]
1414

1515
If you have any _how-to_ kind of questions, please read the [Contributing
1616
Guide][contributing-url] and [Code of Conduct][code_of_conduct-url]
1717
documents.<br /> For bugs reports and feature requests, [please create an
18-
issue][open-issue-url] or ping [@tunnckoCore / @3a1FcBx0](https://twitter.com/3a1FcBx0)
18+
issue][open-issue-url] or ping [@wgw_eth / @wgw_lol](https://twitter.com/wgw_eth)
1919
at Twitter.
2020

2121
[![Conventional Commits][ccommits-img]][ccommits-url]
2222
[![Minimum Required Nodejs][nodejs-img]][npmv-url]
2323
[![Tidelift Subscription][tidelift-img]][tidelift-url]
2424
[![Buy me a Kofi][kofi-img]][kofi-url]
25-
[![Renovate App Status][renovateapp-img]][renovateapp-url]
25+
<!-- [![Renovate App Status][renovateapp-img]][renovateapp-url] -->
2626
[![Make A Pull Request][prs-welcome-img]][prs-welcome-url]
2727

28-
This project is [semantically versioned](https://semver.org) and available as
28+
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.
29+
30+
> [!CAUTION]
31+
> 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.
32+
33+
> [!TIP]
34+
> 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.
35+
36+
<!-- This project is [semantically versioned](https://semver.org) and available as
2937
part of the [Tidelift Subscription][tidelift-url] for professional grade
3038
assurances, enhanced support and security.
3139
[Learn more.](https://tidelift.com/subscription/pkg/npm-formidable?utm_source=npm-formidable&utm_medium=referral&utm_campaign=enterprise)
@@ -34,14 +42,15 @@ _The maintainers of `formidable` and thousands of other packages are working
3442
with Tidelift to deliver commercial support and maintenance for the Open Source
3543
dependencies you use to build your applications. Save time, reduce risk, and
3644
improve code health, while paying the maintainers of the exact dependencies you
37-
use._
45+
use._ -->
3846

3947
[![][npm-weekly-img]][npmv-url] [![][npm-monthly-img]][npmv-url]
4048
[![][npm-yearly-img]][npmv-url] [![][npm-alltime-img]][npmv-url]
4149

4250
## Project Status: Maintained
4351

44-
_Check [VERSION NOTES](https://github.com/node-formidable/formidable/blob/master/VERSION_NOTES.md) for more information on v1, v2, and v3 plans, NPM dist-tags and branches._
52+
> [!NOTE]
53+
> Check [VERSION NOTES](https://github.com/node-formidable/formidable/blob/master/VERSION_NOTES.md) for more information on v1, v2, and v3 plans, NPM dist-tags and branches._
4554
4655
This module was initially developed by
4756
[**@felixge**](https://github.com/felixge) for
@@ -70,9 +79,8 @@ rules, like enabling Two-Factor Auth in your npm and GitHub accounts.
7079

7180
This package is a dual ESM/commonjs package.
7281

73-
This project requires `Node.js >= 10.13`. Install it using
74-
[yarn](https://yarnpkg.com) or [npm](https://npmjs.com).<br /> _We highly
75-
recommend to use Yarn when you think to contribute to this project._
82+
> [!NOTE]
83+
> This project requires `Node.js >= 20`. Install it using [yarn](https://yarnpkg.com) or [npm](https://npmjs.com).<br /> _We highly recommend to use Yarn when you think to contribute to this project._
7684
7785
This is a low-level package, and if you're using a high-level framework it _may_
7886
already be included. Check the examples below and the [examples/](https://github.com/node-formidable/formidable/tree/master/examples) folder.
@@ -425,12 +433,12 @@ multipart stream. Doing so will disable any `'field'` / `'file'` events
425433
processing which would occur otherwise, making you fully responsible for
426434
handling the processing.
427435

428-
About `uploadDir`, given the following directory structure
436+
About `uploadDir`, given the following directory structure
429437
```
430438
project-name
431439
├── src
432440
│ └── server.js
433-
441+
434442
└── uploads
435443
└── image.jpg
436444
```
@@ -620,7 +628,7 @@ export interface File {
620628

621629
// The name this file had according to the uploading client.
622630
file.originalFilename: string | null;
623-
631+
624632
// calculated based on options provided
625633
file.newFilename: string | null;
626634

@@ -670,7 +678,7 @@ file system.
670678

671679
```js
672680
form.on('fileBegin', (formName, file) => {
673-
// accessible here
681+
// accessible here
674682
// formName the name in the form (<input name="thisname" type="file">) or http filename for octetstream
675683
// file.originalFilename http filename or null if there was a parsing error
676684
// file.newFilename generated hexoid or what options.filename returned
@@ -759,7 +767,7 @@ form.parse(request, async (error, fieldsMultiple, files) => {
759767
//...
760768
}
761769
const fieldsSingle = firstValues(form, fieldsMultiple);
762-
770+
763771
const expectedBooleans = ['checkbox1', 'wantsNewsLetter', 'hasACar'];
764772
const fieldsWithBooleans = readBooleans(fieldsSingle, expectedBooleans);
765773
// ...

README_pt_BR.md

Lines changed: 21 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
[![Code style][codestyle-img]][codestyle-url]
1010
[![codecoverage][codecov-img]][codecov-url]
1111
[![linux build status][linux-build-img]][build-url]
12-
[![windows build status][windows-build-img]][build-url]
1312
[![macos build status][macos-build-img]][build-url]
1413

1514
Se você tiver qualquer tipo de pergunta sobre _como_ fazer, por favor leia o [Contributing
@@ -71,7 +70,7 @@ Este projeto requer `Node.js >= 10.13`. Instale-o usando
7170
[yarn](https://yarnpkg.com) ou [npm](https://npmjs.com).<br /> _Nós altamente
7271
recomendamos usar o Yarn quando pensar em contribuir para este projeto._
7372

74-
Este é um pacote de baixo nível e, se você estiver usando uma estrutura de alto nível, _pode_ já estar incluído. Verifique os exemplos
73+
Este é um pacote de baixo nível e, se você estiver usando uma estrutura de alto nível, _pode_ já estar incluído. Verifique os exemplos
7574
abaixo e a pasta [examples/](https://github.com/node-formidable/formidable/tree/master/examples).
7675

7776
```
@@ -83,7 +82,7 @@ npm install formidable@v2
8382
npm install formidable@v3
8483
```
8584

86-
_**Nota:** Em um futuro próximo, a v3 será publicada na dist-tag `latest` do NPM.
85+
_**Nota:** Em um futuro próximo, a v3 será publicada na dist-tag `latest` do NPM.
8786
Versões futuras não prontas serão publicadas nas dist-tags `*-next` para a versão correspondente._
8887

8988

@@ -206,7 +205,7 @@ app.on('error', (err) => {
206205
app.use(async (ctx, next) => {
207206
if (ctx.url === '/api/upload' && ctx.method.toLowerCase() === 'post') {
208207
const form = formidable({});
209-
208+
210209
// não muito elegante, mas é por enquanto se você não quiser usar `koa-better-body`
211210
// ou outros middlewares.
212211
await new Promise((resolve, reject) => {
@@ -359,7 +358,7 @@ form.bytesExpected;
359358

360359
#### `options.filter` **{function}** function ({name, originalFilename, mimetype}) -> boolean
361360

362-
**Observação:** use uma variável externa para cancelar todos os uploads no primeiro erro
361+
**Observação:** use uma variável externa para cancelar todos os uploads no primeiro erro
363362

364363
```js
365364
const options = {
@@ -385,16 +384,16 @@ form.parse(req, (err, fields, files) => {
385384
});
386385
```
387386

388-
Você pode substituir esse método se estiver interessado em acessar diretamente o
389-
fluxo de várias partes. Fazer isso desativará qualquer processamento de eventos `'field'` / `'file'`
387+
Você pode substituir esse método se estiver interessado em acessar diretamente o
388+
fluxo de várias partes. Fazer isso desativará qualquer processamento de eventos `'field'` / `'file'`
390389
que ocorreria de outra forma, tornando você totalmente responsável por lidar com o processamento.
391390

392391
Sobre `uploadDir`, dada a seguinte estrutura de diretório
393392
```
394393
project-name
395394
├── src
396395
│ └── server.js
397-
396+
398397
└── uploads
399398
└── image.jpg
400399
```
@@ -424,7 +423,7 @@ createNecessaryDirectoriesSync(`${uploadPath}/x`);
424423
```
425424

426425

427-
No exemplo abaixo, escutamos alguns eventos e os direcionamos para o ouvinte `data`, para
426+
No exemplo abaixo, escutamos alguns eventos e os direcionamos para o ouvinte `data`, para
428427
que você possa fazer o que quiser lá, com base em se é antes do arquivo ser emitido, o valor do
429428
cabeçalho, o nome do cabeçalho, no campo , em arquivo e etc.
430429

@@ -514,7 +513,7 @@ form.parse(req, (error, fields, files) => {
514513
`this`, para que você possa testar seu plugin mais tarde de forma independente e mais fácil.
515514

516515
Se você quiser desabilitar alguns recursos de análise do Formidable, você pode desabilitar
517-
o plugin que corresponde ao analisador. Por exemplo, se você deseja desabilitar a análise de
516+
o plugin que corresponde ao analisador. Por exemplo, se você deseja desabilitar a análise de
518517
várias partes (para que o [src/parsers/Multipart.js](./src/parsers/Multipart.js)
519518
que é usado em [src/plugins/multipart.js](./src/plugins/multipart.js)), então
520519
você pode removê-lo do `options.enabledPlugins`, assim
@@ -530,8 +529,8 @@ const form = formidable({
530529
**Esteja ciente** de que a ordem _PODE_ ser importante também. Os nomes correspondem 1:1 a
531530
arquivos na pasta [src/plugins/](./src/plugins).
532531

533-
Solicitações pull para novos plug-ins integrados PODEM ser aceitas - por exemplo, analisador de
534-
querystring mais avançado. Adicione seu plugin como um novo arquivo na pasta `src/plugins/` (em letras minúsculas) e
532+
Solicitações pull para novos plug-ins integrados PODEM ser aceitas - por exemplo, analisador de
533+
querystring mais avançado. Adicione seu plugin como um novo arquivo na pasta `src/plugins/` (em letras minúsculas) e
535534
siga como os outros plugins são feitos.
536535

537536
### form.onPart
@@ -581,7 +580,7 @@ export interface File {
581580

582581
// O nome que este arquivo tinha de acordo com o cliente de upload.
583582
file.originalFilename: string | null;
584-
583+
585584
// calculado com base nas opções fornecidas.
586585
file.newFilename: string | null;
587586

@@ -600,7 +599,7 @@ export interface File {
600599

601600
#### file.toJSON()
602601

603-
Este método retorna uma representação JSON do arquivo, permitindo que você `JSON.stringify()`
602+
Este método retorna uma representação JSON do arquivo, permitindo que você `JSON.stringify()`
604603
o arquivo que é útil para registrar e responder a solicitações.
605604

606605
### Eventos
@@ -623,7 +622,7 @@ form.on('field', (name, value) => {});
623622

624623
#### `'fileBegin'`
625624

626-
Emitido sempre que um novo arquivo é detectado no fluxo de upload.
625+
Emitido sempre que um novo arquivo é detectado no fluxo de upload.
627626
Use este evento se desejar transmitir o arquivo para outro lugar enquanto armazena o upload no sistema de arquivos.
628627

629628
```js
@@ -652,7 +651,7 @@ form.on('file', (formname, file) => {
652651

653652
#### `'error'`
654653

655-
Emitido quando há um erro no processamento do formulário recebido. Uma solicitação que
654+
Emitido quando há um erro no processamento do formulário recebido. Uma solicitação que
656655
apresenta um erro é pausada automaticamente, você terá que chamar manualmente
657656
`request.resume()` se você quiser que a requisição continue disparando eventos `'data'`.
658657

@@ -675,7 +674,7 @@ form.on('aborted', () => {});
675674

676675
#### `'end'`
677676

678-
Emitido quando toda a solicitação foi recebida e todos os arquivos contidos foram
677+
Emitido quando toda a solicitação foi recebida e todos os arquivos contidos foram
679678
liberados para o disco. Este é um ótimo lugar para você enviar sua resposta.
680679

681680
```js
@@ -718,7 +717,7 @@ form.parse(request, async (error, fieldsMultiple, files) => {
718717
//...
719718
}
720719
const fieldsSingle = firstValues(form, fieldsMultiple);
721-
720+
722721
const expectedBooleans = ['checkbox1', 'wantsNewsLetter', 'hasACar'];
723722
const fieldsWithBooleans = readBooleans(fieldsSingle, expectedBooleans);
724723
// ...
@@ -736,7 +735,7 @@ form.parse(request, async (error, fieldsMultiple, files) => {
736735
737736
## Contribuindo
738737
739-
Se a documentação não estiver clara ou tiver um erro de digitação, clique no botão `Edit` da página (ícone de lápis) e sugira uma correção.
738+
Se a documentação não estiver clara ou tiver um erro de digitação, clique no botão `Edit` da página (ícone de lápis) e sugira uma correção.
740739
Se você gostaria de nos ajudar a corrigir
741740
um bug ou adicionar um novo recurso, verifique nosso [Contributing
742741
Guide][contribuindo-url]. Pull requests são bem-vindos!
@@ -834,8 +833,7 @@ Formidable é licenciado sob a [MIT License][license-url].
834833
[kofi-url]: https://ko-fi.com/tunnckoCore/commissions
835834
[kofi-img]: https://badgen.net/badge/ko-fi/support/29abe0c2?cache=300&icon=https://rawcdn.githack.com/tunnckoCore/badgen-icons/f8264c6414e0bec449dd86f2241d50a9b89a1203/icons/kofi.svg
836835
837-
[linux-build-img]: https://badgen.net/github/checks/node-formidable/formidable/master/ubuntu?cache=300&label=linux%20build&icon=github
838-
[macos-build-img]: https://badgen.net/github/checks/node-formidable/formidable/master/macos?cache=300&label=macos%20build&icon=github
839-
[windows-build-img]: https://badgen.net/github/checks/node-formidable/formidable/master/windows?cache=300&label=windows%20build&icon=github
840-
[build-url]: https://github.com/node-formidable/formidable/actions?query=workflow%3Anodejs
836+
[linux-build-img]: https://badgen.net/github/checks/node-formidable/formidable/master?cache=30&label=linux%20build&icon=github
837+
[macos-build-img]: https://badgen.net/github/checks/node-formidable/formidable/master?cache=30&label=macos%20build&icon=github
838+
[build-url]: https://github.com/node-formidable/formidable/actions
841839
<!-- prettier-ignore-end -->

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
"test-specific": "node --disable-warning=ExperimentalWarning --experimental-vm-modules ./node_modules/jest/bin/jest.js --testPathPattern=test/standalone/keep-alive-error.test.js",
6464
"test": "npm run test-specific && npm run test-jest && npm run test-node",
6565
"test-jest": "node --disable-warning=ExperimentalWarning --experimental-vm-modules ./node_modules/jest/bin/jest.js --testPathPattern=test/ --coverage",
66-
"test-node": "node --disable-warning=ExperimentalWarning --test test-node/**/*.test.js",
66+
"test-node": "node --disable-warning=ExperimentalWarning --test --experimental-test-coverage test-node/**/*.test.js",
6767
"pretest:ci": "yarn run pretest",
6868
"test:ci": "node --disable-warning=ExperimentalWarning --experimental-vm-modules node_modules/.bin/nyc jest --testPathPattern=test/ --coverage && node --disable-warning=ExperimentalWarning --experimental-vm-modules node_modules/.bin/nyc node --test test-node/"
6969
},

0 commit comments

Comments
 (0)