Skip to content

Commit 2dd3bb6

Browse files
Merge pull request #30 from tinyhttp/add-type
add `type` option
2 parents 61f919d + b448dd3 commit 2dd3bb6

File tree

15 files changed

+1100
-269
lines changed

15 files changed

+1100
-269
lines changed

.github/workflows/publish.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,3 @@ jobs:
2626
- name: Run Biome
2727
run: biome ci .
2828
- run: pnpm publish --no-git-checks
29-
env:
30-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,5 @@ typings/
4343

4444
dist
4545
coverage
46-
coverage.lcov
46+
coverage.lcov
47+
.DS_Store

.vscode/settings.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@
88
"source.fixAll": "explicit",
99
"source.organizeImports.biome": "explicit"
1010
},
11-
"typescript.tsdk": "node_modules/typescript/lib"
11+
"typescript.tsdk": "node_modules/typescript/lib",
12+
"[typescript]": {
13+
"editor.defaultFormatter": "biomejs.biome"
14+
}
1215
}

bench/formidable.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
import { createReadStream } from 'node:fs'
21
// @ts-check
2+
3+
import { createReadStream } from 'node:fs'
34
import { createServer } from 'node:http'
45
import formidable from 'formidable'
56

67
const form = formidable({})
78

89
const server = createServer((req, res) => {
9-
form.parse(req, (_, fields, files) => {
10-
// @ts-expect-error this is JS
10+
form.parse(req, (_, _fields, files) => {
11+
// @ts-expect-error the file is guaaranteed in payload
1112
const file = createReadStream(files.file[0].filepath)
1213
file.pipe(res)
1314
})

bench/milliparsec-multipart.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
import { createServer } from 'node:http'
44
import * as bodyParser from '../dist/index.js'
5+
56
const mw = bodyParser.multipart()
67

78
const server = createServer((req, res) => {
89
mw(req, res, () => {
910
/**
1011
* @type {File}
1112
*/
12-
// @ts-ignore
13+
// @ts-expect-error
1314
const file = req.body.file[0]
1415
const stream = file.stream()
1516

bench/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,12 @@
1212
"author": "",
1313
"license": "ISC",
1414
"devDependencies": {
15-
"@types/body-parser": "^1.19.5",
15+
"@types/body-parser": "^1.19.6",
1616
"@types/formidable": "^3.4.5",
1717
"autocannon": "^8.0.0",
18-
"body-parser": "^1.20.3"
18+
"body-parser": "^2.2.0"
1919
},
2020
"dependencies": {
21-
"formidable": "^3.5.2"
21+
"formidable": "^3.5.4"
2222
}
2323
}

0 commit comments

Comments
 (0)