@remix-run/multipart-parser 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -45
- package/dist/{multipart-parser.d.ts → index.d.ts} +1 -1
- package/dist/index.d.ts.map +1 -0
- package/dist/{multipart-parser.js → index.js} +4 -4
- package/dist/index.js.map +7 -0
- package/dist/lib/buffer-search.d.ts.map +1 -1
- package/dist/lib/multipart-request.d.ts.map +1 -1
- package/dist/lib/multipart.d.ts.map +1 -1
- package/dist/lib/multipart.node.d.ts.map +1 -1
- package/dist/{multipart-parser.node.d.ts → node.d.ts} +2 -2
- package/dist/node.d.ts.map +1 -0
- package/dist/{multipart-parser.node.js → node.js} +4 -4
- package/dist/node.js.map +7 -0
- package/package.json +14 -22
- package/src/{multipart-parser.ts → index.ts} +3 -3
- package/src/lib/buffer-search.ts +25 -25
- package/src/lib/multipart-request.ts +11 -11
- package/src/lib/multipart.node.ts +13 -13
- package/src/lib/multipart.ts +123 -123
- package/src/lib/read-stream.ts +5 -5
- package/src/{multipart-parser.node.ts → node.ts} +9 -4
- package/dist/multipart-parser.cjs +0 -2021
- package/dist/multipart-parser.cjs.map +0 -7
- package/dist/multipart-parser.d.ts.map +0 -1
- package/dist/multipart-parser.js.map +0 -7
- package/dist/multipart-parser.node.cjs +0 -2027
- package/dist/multipart-parser.node.cjs.map +0 -7
- package/dist/multipart-parser.node.d.ts.map +0 -1
- package/dist/multipart-parser.node.js.map +0 -7
package/README.md
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
- Convenient `MultipartPart` API with `arrayBuffer`, `bytes`, `text`, `size`, and metadata access
|
|
20
20
|
- Built-in file size limiting to prevent abuse
|
|
21
21
|
- First-class Node.js support with native `http.IncomingMessage` compatibility
|
|
22
|
-
- [
|
|
22
|
+
- [Demos for every major runtime](https://github.com/remix-run/remix/tree/main/packages/multipart-parser/demos)
|
|
23
23
|
|
|
24
24
|
## Installation
|
|
25
25
|
|
|
@@ -29,41 +29,35 @@ Install from [npm](https://www.npmjs.com/):
|
|
|
29
29
|
npm install @remix-run/multipart-parser
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
Or install from [JSR](https://jsr.io/):
|
|
33
|
-
|
|
34
|
-
```sh
|
|
35
|
-
deno add @remix-run/multipart-parser
|
|
36
|
-
```
|
|
37
|
-
|
|
38
32
|
## Usage
|
|
39
33
|
|
|
40
34
|
The most common use case for `multipart-parser` is handling file uploads when you're building a web server. For this case, the `parseMultipartRequest` function is your friend. It automatically validates the request is `multipart/form-data`, extracts the multipart boundary from the `Content-Type` header, parses all fields and files in the `request.body` stream, and gives each one to you as a `MultipartPart` object with a rich API for accessing its metadata and content.
|
|
41
35
|
|
|
42
36
|
```ts
|
|
43
|
-
import { MultipartParseError, parseMultipartRequest } from '@remix-run/multipart-parser'
|
|
37
|
+
import { MultipartParseError, parseMultipartRequest } from '@remix-run/multipart-parser'
|
|
44
38
|
|
|
45
39
|
async function handleRequest(request: Request): void {
|
|
46
40
|
try {
|
|
47
41
|
for await (let part of parseMultipartRequest(request)) {
|
|
48
42
|
if (part.isFile) {
|
|
49
43
|
// Access file data in multiple formats
|
|
50
|
-
let buffer = part.arrayBuffer
|
|
51
|
-
console.log(`File received: ${part.filename} (${buffer.byteLength} bytes)`)
|
|
52
|
-
console.log(`Content type: ${part.mediaType}`)
|
|
53
|
-
console.log(`Field name: ${part.name}`)
|
|
44
|
+
let buffer = part.arrayBuffer // ArrayBuffer
|
|
45
|
+
console.log(`File received: ${part.filename} (${buffer.byteLength} bytes)`)
|
|
46
|
+
console.log(`Content type: ${part.mediaType}`)
|
|
47
|
+
console.log(`Field name: ${part.name}`)
|
|
54
48
|
|
|
55
49
|
// Save to disk, upload to cloud storage, etc.
|
|
56
|
-
await saveFile(part.filename, part.bytes)
|
|
50
|
+
await saveFile(part.filename, part.bytes)
|
|
57
51
|
} else {
|
|
58
|
-
let text = part.text
|
|
59
|
-
console.log(`Field received: ${part.name} = ${JSON.stringify(text)}`)
|
|
52
|
+
let text = part.text // string
|
|
53
|
+
console.log(`Field received: ${part.name} = ${JSON.stringify(text)}`)
|
|
60
54
|
}
|
|
61
55
|
}
|
|
62
56
|
} catch (error) {
|
|
63
57
|
if (error instanceof MultipartParseError) {
|
|
64
|
-
console.error('Failed to parse multipart request:', error.message)
|
|
58
|
+
console.error('Failed to parse multipart request:', error.message)
|
|
65
59
|
} else {
|
|
66
|
-
console.error('An unexpected error occurred:', error)
|
|
60
|
+
console.error('An unexpected error occurred:', error)
|
|
67
61
|
}
|
|
68
62
|
}
|
|
69
63
|
}
|
|
@@ -78,10 +72,10 @@ import {
|
|
|
78
72
|
MultipartParseError,
|
|
79
73
|
MaxFileSizeExceededError,
|
|
80
74
|
parseMultipartRequest,
|
|
81
|
-
} from '@remix-run/multipart-parser/node'
|
|
75
|
+
} from '@remix-run/multipart-parser/node'
|
|
82
76
|
|
|
83
|
-
const oneMb = Math.pow(2, 20)
|
|
84
|
-
const maxFileSize = 10 * oneMb
|
|
77
|
+
const oneMb = Math.pow(2, 20)
|
|
78
|
+
const maxFileSize = 10 * oneMb
|
|
85
79
|
|
|
86
80
|
async function handleRequest(request: Request): Promise<Response> {
|
|
87
81
|
try {
|
|
@@ -90,12 +84,12 @@ async function handleRequest(request: Request): Promise<Response> {
|
|
|
90
84
|
}
|
|
91
85
|
} catch (error) {
|
|
92
86
|
if (error instanceof MaxFileSizeExceededError) {
|
|
93
|
-
return new Response('File size limit exceeded', { status: 413 })
|
|
87
|
+
return new Response('File size limit exceeded', { status: 413 })
|
|
94
88
|
} else if (error instanceof MultipartParseError) {
|
|
95
|
-
return new Response('Failed to parse multipart request', { status: 400 })
|
|
89
|
+
return new Response('Failed to parse multipart request', { status: 400 })
|
|
96
90
|
} else {
|
|
97
|
-
console.error(error)
|
|
98
|
-
return new Response('Internal Server Error', { status: 500 })
|
|
91
|
+
console.error(error)
|
|
92
|
+
return new Response('Internal Server Error', { status: 500 })
|
|
99
93
|
}
|
|
100
94
|
}
|
|
101
95
|
}
|
|
@@ -108,8 +102,8 @@ The main module (`import from "@remix-run/multipart-parser"`) assumes you're wor
|
|
|
108
102
|
If however you're building a server for Node.js that relies on node-specific APIs like `http.IncomingMessage`, `stream.Readable`, and `buffer.Buffer` (ala Express or `http.createServer`), `multipart-parser` ships with an additional module that works directly with these APIs.
|
|
109
103
|
|
|
110
104
|
```ts
|
|
111
|
-
import * as http from 'node:http'
|
|
112
|
-
import { MultipartParseError, parseMultipartRequest } from '@remix-run/multipart-parser/node'
|
|
105
|
+
import * as http from 'node:http'
|
|
106
|
+
import { MultipartParseError, parseMultipartRequest } from '@remix-run/multipart-parser/node'
|
|
113
107
|
|
|
114
108
|
let server = http.createServer(async (req, res) => {
|
|
115
109
|
try {
|
|
@@ -118,14 +112,14 @@ let server = http.createServer(async (req, res) => {
|
|
|
118
112
|
}
|
|
119
113
|
} catch (error) {
|
|
120
114
|
if (error instanceof MultipartParseError) {
|
|
121
|
-
console.error('Failed to parse multipart request:', error.message)
|
|
115
|
+
console.error('Failed to parse multipart request:', error.message)
|
|
122
116
|
} else {
|
|
123
|
-
console.error('An unexpected error occurred:', error)
|
|
117
|
+
console.error('An unexpected error occurred:', error)
|
|
124
118
|
}
|
|
125
119
|
}
|
|
126
|
-
})
|
|
120
|
+
})
|
|
127
121
|
|
|
128
|
-
server.listen(8080)
|
|
122
|
+
server.listen(8080)
|
|
129
123
|
```
|
|
130
124
|
|
|
131
125
|
## Low-level API
|
|
@@ -133,10 +127,10 @@ server.listen(8080);
|
|
|
133
127
|
If you're working directly with multipart boundaries and buffers/streams of multipart data that are not necessarily part of a request, `multipart-parser` provides a low-level `parseMultipart()` API that you can use directly:
|
|
134
128
|
|
|
135
129
|
```ts
|
|
136
|
-
import { parseMultipart } from '@remix-run/multipart-parser'
|
|
130
|
+
import { parseMultipart } from '@remix-run/multipart-parser'
|
|
137
131
|
|
|
138
|
-
let message = new Uint8Array(/* ... */)
|
|
139
|
-
let boundary = '----WebKitFormBoundary56eac3x'
|
|
132
|
+
let message = new Uint8Array(/* ... */)
|
|
133
|
+
let boundary = '----WebKitFormBoundary56eac3x'
|
|
140
134
|
|
|
141
135
|
for (let part of parseMultipart(message, { boundary })) {
|
|
142
136
|
// ...
|
|
@@ -146,24 +140,24 @@ for (let part of parseMultipart(message, { boundary })) {
|
|
|
146
140
|
In addition, the `parseMultipartStream` function provides an `async` generator interface for multipart data in a `ReadableStream`:
|
|
147
141
|
|
|
148
142
|
```ts
|
|
149
|
-
import { parseMultipartStream } from '@remix-run/multipart-parser'
|
|
143
|
+
import { parseMultipartStream } from '@remix-run/multipart-parser'
|
|
150
144
|
|
|
151
|
-
let message = new ReadableStream(/* ... */)
|
|
152
|
-
let boundary = '----WebKitFormBoundary56eac3x'
|
|
145
|
+
let message = new ReadableStream(/* ... */)
|
|
146
|
+
let boundary = '----WebKitFormBoundary56eac3x'
|
|
153
147
|
|
|
154
148
|
for await (let part of parseMultipartStream(message, { boundary })) {
|
|
155
149
|
// ...
|
|
156
150
|
}
|
|
157
151
|
```
|
|
158
152
|
|
|
159
|
-
##
|
|
153
|
+
## Demos
|
|
160
154
|
|
|
161
|
-
The [`
|
|
155
|
+
The [`demos` directory](https://github.com/remix-run/remix/tree/main/packages/multipart-parser/demos) contains a few working demos of how you can use this library:
|
|
162
156
|
|
|
163
|
-
- [`
|
|
164
|
-
- [`
|
|
165
|
-
- [`
|
|
166
|
-
- [`
|
|
157
|
+
- [`demos/bun`](https://github.com/remix-run/remix/tree/main/packages/multipart-parser/demos/bun) - using multipart-parser in Bun
|
|
158
|
+
- [`demos/cf-workers`](https://github.com/remix-run/remix/tree/main/packages/multipart-parser/demos/cf-workers) - using multipart-parser in a Cloudflare Worker and storing file uploads in R2
|
|
159
|
+
- [`demos/deno`](https://github.com/remix-run/remix/tree/main/packages/multipart-parser/demos/deno) - using multipart-parser in Deno
|
|
160
|
+
- [`demos/node`](https://github.com/remix-run/remix/tree/main/packages/multipart-parser/demos/node) - using multipart-parser in Node.js
|
|
167
161
|
|
|
168
162
|
## Benchmark
|
|
169
163
|
|
|
@@ -223,8 +217,8 @@ Deno 2.3.6
|
|
|
223
217
|
|
|
224
218
|
## Related Packages
|
|
225
219
|
|
|
226
|
-
- [`form-data-parser`](https://github.com/remix-run/remix/tree/
|
|
227
|
-
- [`headers`](https://github.com/remix-run/remix/tree/
|
|
220
|
+
- [`form-data-parser`](https://github.com/remix-run/remix/tree/main/packages/form-data-parser) - Uses `multipart-parser` internally to parse multipart requests and generate `FileUpload`s for storage
|
|
221
|
+
- [`headers`](https://github.com/remix-run/remix/tree/main/packages/headers) - Used internally to parse HTTP headers and get metadata (filename, content type) for each `MultipartPart`
|
|
228
222
|
|
|
229
223
|
## Credits
|
|
230
224
|
|
|
@@ -232,4 +226,4 @@ Thanks to Jacob Ebey who gave me several code reviews on this project prior to p
|
|
|
232
226
|
|
|
233
227
|
## License
|
|
234
228
|
|
|
235
|
-
See [LICENSE](https://github.com/remix-run/remix/blob/
|
|
229
|
+
See [LICENSE](https://github.com/remix-run/remix/blob/main/LICENSE)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export type { ParseMultipartOptions, MultipartParserOptions } from './lib/multipart.ts';
|
|
2
2
|
export { MultipartParseError, MaxHeaderSizeExceededError, MaxFileSizeExceededError, parseMultipart, parseMultipartStream, MultipartParser, MultipartPart, } from './lib/multipart.ts';
|
|
3
3
|
export { getMultipartBoundary, isMultipartRequest, parseMultipartRequest, } from './lib/multipart-request.ts';
|
|
4
|
-
//# sourceMappingURL=
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AACvF,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,wBAAwB,EACxB,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,aAAa,GACd,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,4BAA4B,CAAA"}
|
|
@@ -1604,9 +1604,9 @@ async function* readStream(stream) {
|
|
|
1604
1604
|
let reader = stream.getReader();
|
|
1605
1605
|
try {
|
|
1606
1606
|
while (true) {
|
|
1607
|
-
|
|
1608
|
-
if (done) break;
|
|
1609
|
-
yield value;
|
|
1607
|
+
let result = await reader.read();
|
|
1608
|
+
if (result.done) break;
|
|
1609
|
+
yield result.value;
|
|
1610
1610
|
}
|
|
1611
1611
|
} finally {
|
|
1612
1612
|
reader.releaseLock();
|
|
@@ -1982,4 +1982,4 @@ export {
|
|
|
1982
1982
|
parseMultipartRequest,
|
|
1983
1983
|
parseMultipartStream
|
|
1984
1984
|
};
|
|
1985
|
-
//# sourceMappingURL=
|
|
1985
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../headers/src/lib/param-values.ts", "../../headers/src/lib/utils.ts", "../../headers/src/lib/accept.ts", "../../headers/src/lib/accept-encoding.ts", "../../headers/src/lib/accept-language.ts", "../../headers/src/lib/cache-control.ts", "../../headers/src/lib/content-disposition.ts", "../../headers/src/lib/content-type.ts", "../../headers/src/lib/cookie.ts", "../../headers/src/lib/if-none-match.ts", "../../headers/src/lib/set-cookie.ts", "../../headers/src/lib/header-names.ts", "../../headers/src/lib/super-headers.ts", "../src/lib/read-stream.ts", "../src/lib/buffer-search.ts", "../src/lib/multipart.ts", "../src/lib/multipart-request.ts"],
|
|
4
|
+
"sourcesContent": ["export function parseParams(\n input: string,\n delimiter: ';' | ',' = ';',\n): [string, string | undefined][] {\n // This parser splits on the delimiter and unquotes any quoted values\n // like `filename=\"the\\\\ filename.txt\"`.\n let parser =\n delimiter === ';'\n ? /(?:^|;)\\s*([^=;\\s]+)(\\s*=\\s*(?:\"((?:[^\"\\\\]|\\\\.)*)\"|((?:[^;]|\\\\\\;)+))?)?/g\n : /(?:^|,)\\s*([^=,\\s]+)(\\s*=\\s*(?:\"((?:[^\"\\\\]|\\\\.)*)\"|((?:[^,]|\\\\\\,)+))?)?/g\n\n let params: [string, string | undefined][] = []\n\n let match\n while ((match = parser.exec(input)) !== null) {\n let key = match[1].trim()\n\n let value: string | undefined\n if (match[2]) {\n value = (match[3] || match[4] || '').replace(/\\\\(.)/g, '$1').trim()\n }\n\n params.push([key, value])\n }\n\n return params\n}\n\nexport function quote(value: string): string {\n if (value.includes('\"') || value.includes(';') || value.includes(' ')) {\n return `\"${value.replace(/\"/g, '\\\\\"')}\"`\n }\n return value\n}\n", "export function capitalize(str: string): string {\n return str.charAt(0).toUpperCase() + str.slice(1).toLowerCase()\n}\n\nexport function isIterable<T>(value: any): value is Iterable<T> {\n return value != null && typeof value[Symbol.iterator] === 'function'\n}\n\nexport function isValidDate(date: unknown): boolean {\n return date instanceof Date && !isNaN(date.getTime())\n}\n\nexport function quoteEtag(tag: string): string {\n return tag === '*' ? tag : /^(W\\/)?\".*\"$/.test(tag) ? tag : `\"${tag}\"`\n}\n", "import { type HeaderValue } from './header-value.ts'\nimport { parseParams } from './param-values.ts'\nimport { isIterable } from './utils.ts'\n\nexport type AcceptInit = Iterable<string | [string, number]> | Record<string, number>\n\n/**\n * The value of a `Accept` HTTP header.\n *\n * [MDN `Accept` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7231#section-5.3.2)\n */\nexport class Accept implements HeaderValue, Iterable<[string, number]> {\n #map: Map<string, number>\n\n constructor(init?: string | AcceptInit) {\n this.#map = new Map()\n\n if (init) {\n if (typeof init === 'string') {\n for (let piece of init.split(/\\s*,\\s*/)) {\n let params = parseParams(piece)\n if (params.length < 1) continue\n\n let mediaType = params[0][0]\n let weight = 1\n\n for (let i = 1; i < params.length; i++) {\n let [key, value] = params[i]\n if (key === 'q') {\n weight = Number(value)\n break\n }\n }\n\n this.#map.set(mediaType.toLowerCase(), weight)\n }\n } else if (isIterable(init)) {\n for (let mediaType of init) {\n if (Array.isArray(mediaType)) {\n this.#map.set(mediaType[0].toLowerCase(), mediaType[1])\n } else {\n this.#map.set(mediaType.toLowerCase(), 1)\n }\n }\n } else {\n for (let mediaType of Object.getOwnPropertyNames(init)) {\n this.#map.set(mediaType.toLowerCase(), init[mediaType])\n }\n }\n\n this.#sort()\n }\n }\n\n #sort() {\n this.#map = new Map([...this.#map].sort((a, b) => b[1] - a[1]))\n }\n\n /**\n * An array of all media types in the header.\n */\n get mediaTypes(): string[] {\n return Array.from(this.#map.keys())\n }\n\n /**\n * An array of all weights (q values) in the header.\n */\n get weights(): number[] {\n return Array.from(this.#map.values())\n }\n\n /**\n * The number of media types in the `Accept` header.\n */\n get size(): number {\n return this.#map.size\n }\n\n /**\n * Returns `true` if the header matches the given media type (i.e. it is \"acceptable\").\n * @param mediaType The media type to check.\n * @returns `true` if the media type is acceptable, `false` otherwise.\n */\n accepts(mediaType: string): boolean {\n return this.getWeight(mediaType) > 0\n }\n\n /**\n * Gets the weight of a given media type. Also supports wildcards, so e.g. `text/*` will match `text/html`.\n * @param mediaType The media type to get the weight of.\n * @returns The weight of the media type.\n */\n getWeight(mediaType: string): number {\n let [type, subtype] = mediaType.toLowerCase().split('/')\n\n for (let [key, value] of this) {\n let [t, s] = key.split('/')\n if (\n (t === type || t === '*' || type === '*') &&\n (s === subtype || s === '*' || subtype === '*')\n ) {\n return value\n }\n }\n\n return 0\n }\n\n /**\n * Returns the most preferred media type from the given list of media types.\n * @param mediaTypes The list of media types to choose from.\n * @returns The most preferred media type or `null` if none match.\n */\n getPreferred(mediaTypes: string[]): string | null {\n let sorted = mediaTypes\n .map((mediaType) => [mediaType, this.getWeight(mediaType)] as const)\n .sort((a, b) => b[1] - a[1])\n\n let first = sorted[0]\n\n return first !== undefined && first[1] > 0 ? first[0] : null\n }\n\n /**\n * Returns the weight of a media type. If it is not in the header verbatim, this returns `null`.\n * @param mediaType The media type to get the weight of.\n * @returns The weight of the media type, or `null` if it is not in the header.\n */\n get(mediaType: string): number | null {\n return this.#map.get(mediaType.toLowerCase()) ?? null\n }\n\n /**\n * Sets a media type with the given weight.\n * @param mediaType The media type to set.\n * @param weight The weight of the media type. Defaults to 1.\n */\n set(mediaType: string, weight = 1): void {\n this.#map.set(mediaType.toLowerCase(), weight)\n this.#sort()\n }\n\n /**\n * Removes the given media type from the header.\n * @param mediaType The media type to remove.\n */\n delete(mediaType: string): void {\n this.#map.delete(mediaType.toLowerCase())\n }\n\n /**\n * Checks if a media type is in the header.\n * @param mediaType The media type to check.\n * @returns `true` if the media type is in the header (verbatim), `false` otherwise.\n */\n has(mediaType: string): boolean {\n return this.#map.has(mediaType.toLowerCase())\n }\n\n /**\n * Removes all media types from the header.\n */\n clear(): void {\n this.#map.clear()\n }\n\n entries(): IterableIterator<[string, number]> {\n return this.#map.entries()\n }\n\n [Symbol.iterator](): IterableIterator<[string, number]> {\n return this.entries()\n }\n\n forEach(\n callback: (mediaType: string, weight: number, header: Accept) => void,\n thisArg?: any,\n ): void {\n for (let [mediaType, weight] of this) {\n callback.call(thisArg, mediaType, weight, this)\n }\n }\n\n toString(): string {\n let pairs: string[] = []\n\n for (let [mediaType, weight] of this.#map) {\n pairs.push(`${mediaType}${weight === 1 ? '' : `;q=${weight}`}`)\n }\n\n return pairs.join(',')\n }\n}\n", "import { type HeaderValue } from './header-value.ts'\nimport { parseParams } from './param-values.ts'\nimport { isIterable } from './utils.ts'\n\nexport type AcceptEncodingInit = Iterable<string | [string, number]> | Record<string, number>\n\n/**\n * The value of a `Accept-Encoding` HTTP header.\n *\n * [MDN `Accept-Encoding` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7231#section-5.3.4)\n */\nexport class AcceptEncoding implements HeaderValue, Iterable<[string, number]> {\n #map: Map<string, number>\n\n constructor(init?: string | AcceptEncodingInit) {\n this.#map = new Map()\n\n if (init) {\n if (typeof init === 'string') {\n for (let piece of init.split(/\\s*,\\s*/)) {\n let params = parseParams(piece)\n if (params.length < 1) continue\n\n let encoding = params[0][0]\n let weight = 1\n\n for (let i = 1; i < params.length; i++) {\n let [key, value] = params[i]\n if (key === 'q') {\n weight = Number(value)\n break\n }\n }\n\n this.#map.set(encoding.toLowerCase(), weight)\n }\n } else if (isIterable(init)) {\n for (let value of init) {\n if (Array.isArray(value)) {\n this.#map.set(value[0].toLowerCase(), value[1])\n } else {\n this.#map.set(value.toLowerCase(), 1)\n }\n }\n } else {\n for (let encoding of Object.getOwnPropertyNames(init)) {\n this.#map.set(encoding.toLowerCase(), init[encoding])\n }\n }\n\n this.#sort()\n }\n }\n\n #sort() {\n this.#map = new Map([...this.#map].sort((a, b) => b[1] - a[1]))\n }\n\n /**\n * An array of all encodings in the header.\n */\n get encodings(): string[] {\n return Array.from(this.#map.keys())\n }\n\n /**\n * An array of all weights (q values) in the header.\n */\n get weights(): number[] {\n return Array.from(this.#map.values())\n }\n\n /**\n * The number of encodings in the header.\n */\n get size(): number {\n return this.#map.size\n }\n\n /**\n * Returns `true` if the header matches the given encoding (i.e. it is \"acceptable\").\n * @param encoding The encoding to check.\n * @returns `true` if the encoding is acceptable, `false` otherwise.\n */\n accepts(encoding: string): boolean {\n return encoding.toLowerCase() === 'identity' || this.getWeight(encoding) > 0\n }\n\n /**\n * Gets the weight an encoding. Performs wildcard matching so `*` matches all encodings.\n * @param encoding The encoding to get.\n * @returns The weight of the encoding, or `0` if it is not in the header.\n */\n getWeight(encoding: string): number {\n let lower = encoding.toLowerCase()\n\n for (let [enc, weight] of this) {\n if (enc === lower || enc === '*' || lower === '*') {\n return weight\n }\n }\n\n return 0\n }\n\n /**\n * Returns the most preferred encoding from the given list of encodings.\n * @param encodings The encodings to choose from.\n * @returns The most preferred encoding or `null` if none match.\n */\n getPreferred(encodings: string[]): string | null {\n let sorted = encodings\n .map((encoding) => [encoding, this.getWeight(encoding)] as const)\n .sort((a, b) => b[1] - a[1])\n\n let first = sorted[0]\n\n return first !== undefined && first[1] > 0 ? first[0] : null\n }\n\n /**\n * Gets the weight of an encoding. If it is not in the header verbatim, this returns `null`.\n * @param encoding The encoding to get.\n * @returns The weight of the encoding, or `null` if it is not in the header.\n */\n get(encoding: string): number | null {\n return this.#map.get(encoding.toLowerCase()) ?? null\n }\n\n /**\n * Sets an encoding with the given weight.\n * @param encoding The encoding to set.\n * @param weight The weight of the encoding. Defaults to 1.\n */\n set(encoding: string, weight = 1): void {\n this.#map.set(encoding.toLowerCase(), weight)\n this.#sort()\n }\n\n /**\n * Removes the given encoding from the header.\n * @param encoding The encoding to remove.\n */\n delete(encoding: string): void {\n this.#map.delete(encoding.toLowerCase())\n }\n\n /**\n * Checks if the header contains a given encoding.\n * @param encoding The encoding to check.\n * @returns `true` if the encoding is in the header, `false` otherwise.\n */\n has(encoding: string): boolean {\n return this.#map.has(encoding.toLowerCase())\n }\n\n /**\n * Removes all encodings from the header.\n */\n clear(): void {\n this.#map.clear()\n }\n\n entries(): IterableIterator<[string, number]> {\n return this.#map.entries()\n }\n\n [Symbol.iterator](): IterableIterator<[string, number]> {\n return this.entries()\n }\n\n forEach(\n callback: (encoding: string, weight: number, header: AcceptEncoding) => void,\n thisArg?: any,\n ): void {\n for (let [encoding, weight] of this) {\n callback.call(thisArg, encoding, weight, this)\n }\n }\n\n toString(): string {\n let pairs: string[] = []\n\n for (let [encoding, weight] of this.#map) {\n pairs.push(`${encoding}${weight === 1 ? '' : `;q=${weight}`}`)\n }\n\n return pairs.join(',')\n }\n}\n", "import { type HeaderValue } from './header-value.ts'\nimport { parseParams } from './param-values.ts'\nimport { isIterable } from './utils.ts'\n\nexport type AcceptLanguageInit = Iterable<string | [string, number]> | Record<string, number>\n\n/**\n * The value of a `Accept-Language` HTTP header.\n *\n * [MDN `Accept-Language` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7231#section-5.3.5)\n */\nexport class AcceptLanguage implements HeaderValue, Iterable<[string, number]> {\n #map: Map<string, number>\n\n constructor(init?: string | AcceptLanguageInit) {\n this.#map = new Map()\n\n if (init) {\n if (typeof init === 'string') {\n for (let piece of init.split(/\\s*,\\s*/)) {\n let params = parseParams(piece)\n if (params.length < 1) continue\n\n let language = params[0][0]\n let weight = 1\n\n for (let i = 1; i < params.length; i++) {\n let [key, value] = params[i]\n if (key === 'q') {\n weight = Number(value)\n break\n }\n }\n\n this.#map.set(language.toLowerCase(), weight)\n }\n } else if (isIterable(init)) {\n for (let value of init) {\n if (Array.isArray(value)) {\n this.#map.set(value[0].toLowerCase(), value[1])\n } else {\n this.#map.set(value.toLowerCase(), 1)\n }\n }\n } else {\n for (let language of Object.getOwnPropertyNames(init)) {\n this.#map.set(language.toLowerCase(), init[language])\n }\n }\n\n this.#sort()\n }\n }\n\n #sort() {\n this.#map = new Map([...this.#map].sort((a, b) => b[1] - a[1]))\n }\n\n /**\n * An array of all languages in the header.\n */\n get languages(): string[] {\n return Array.from(this.#map.keys())\n }\n\n /**\n * An array of all weights (q values) in the header.\n */\n get weights(): number[] {\n return Array.from(this.#map.values())\n }\n\n /**\n * The number of languages in the header.\n */\n get size(): number {\n return this.#map.size\n }\n\n /**\n * Returns `true` if the header matches the given language (i.e. it is \"acceptable\").\n * @param language The locale identifier of the language to check.\n * @returns `true` if the language is acceptable, `false` otherwise.\n */\n accepts(language: string): boolean {\n return this.getWeight(language) > 0\n }\n\n /**\n * Gets the weight of a language with the given locale identifier. Performs wildcard and subtype\n * matching, so `en` matches `en-US` and `en-GB`, and `*` matches all languages.\n * @param language The locale identifier of the language to get.\n * @returns The weight of the language, or `0` if it is not in the header.\n */\n getWeight(language: string): number {\n let [base, subtype] = language.toLowerCase().split('-')\n\n for (let [key, value] of this) {\n let [b, s] = key.split('-')\n if (\n (b === base || b === '*' || base === '*') &&\n (s === subtype || s === undefined || subtype === undefined)\n ) {\n return value\n }\n }\n\n return 0\n }\n\n /**\n * Returns the most preferred language from the given list of languages.\n * @param languages The locale identifiers of the languages to choose from.\n * @returns The most preferred language or `null` if none match.\n */\n getPreferred(languages: string[]): string | null {\n let sorted = languages\n .map((language) => [language, this.getWeight(language)] as const)\n .sort((a, b) => b[1] - a[1])\n\n let first = sorted[0]\n\n return first !== undefined && first[1] > 0 ? first[0] : null\n }\n\n /**\n * Gets the weight of a language with the given locale identifier. If it is not in the header\n * verbatim, this returns `null`.\n * @param language The locale identifier of the language to get.\n * @returns The weight of the language, or `null` if it is not in the header.\n */\n get(language: string): number | null {\n return this.#map.get(language.toLowerCase()) ?? null\n }\n\n /**\n * Sets a language with the given weight.\n * @param language The locale identifier of the language to set.\n * @param weight The weight of the language. Defaults to 1.\n */\n set(language: string, weight = 1): void {\n this.#map.set(language.toLowerCase(), weight)\n this.#sort()\n }\n\n /**\n * Removes a language with the given locale identifier.\n * @param language The locale identifier of the language to remove.\n */\n delete(language: string): void {\n this.#map.delete(language.toLowerCase())\n }\n\n /**\n * Checks if the header contains a language with the given locale identifier.\n * @param language The locale identifier of the language to check.\n * @returns `true` if the language is in the header, `false` otherwise.\n */\n has(language: string): boolean {\n return this.#map.has(language.toLowerCase())\n }\n\n /**\n * Removes all languages from the header.\n */\n clear(): void {\n this.#map.clear()\n }\n\n entries(): IterableIterator<[string, number]> {\n return this.#map.entries()\n }\n\n [Symbol.iterator](): IterableIterator<[string, number]> {\n return this.entries()\n }\n\n forEach(\n callback: (language: string, weight: number, header: AcceptLanguage) => void,\n thisArg?: any,\n ): void {\n for (let [language, weight] of this) {\n callback.call(thisArg, language, weight, this)\n }\n }\n\n toString(): string {\n let pairs: string[] = []\n\n for (let [language, weight] of this.#map) {\n pairs.push(`${language}${weight === 1 ? '' : `;q=${weight}`}`)\n }\n\n return pairs.join(',')\n }\n}\n", "import { type HeaderValue } from './header-value.ts'\nimport { parseParams } from './param-values.ts'\n\n// Taken from https://github.com/jjenzz/pretty-cache-header by jjenzz\n// License: MIT https://github.com/jjenzz/pretty-cache-header/blob/main/LICENSE\nexport interface CacheControlInit {\n /**\n * The `max-age=N` **request directive** indicates that the client allows a stored response that\n * is generated on the origin server within _N_ seconds \u2014 where _N_ may be any non-negative\n * integer (including `0`).\n *\n * The `max-age=N` **response directive** indicates that the response remains\n * [fresh](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#fresh_and_stale_based_on_age)\n * until _N_ seconds after the response is generated.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#max-age)\n */\n maxAge?: number\n /**\n * The `max-stale=N` **request directive** indicates that the client allows a stored response\n * that is [stale](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#fresh_and_stale_based_on_age)\n * within _N_ seconds.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#max-stale)\n */\n maxStale?: number\n /**\n * The `min-fresh=N` **request directive** indicates that the client allows a stored response\n * that is [fresh](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#fresh_and_stale_based_on_age)\n * for at least _N_ seconds.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#min-fresh)\n */\n minFresh?: number\n /**\n * The `s-maxage` **response directive** also indicates how long the response is\n * [fresh](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#fresh_and_stale_based_on_age) for (similar to `max-age`) \u2014\n * but it is specific to shared caches, and they will ignore `max-age` when it is present.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#s-maxage)\n */\n sMaxage?: number\n /**\n * The `no-cache` **request directive** asks caches to validate the response with the origin\n * server before reuse. If you want caches to always check for content updates while reusing\n * stored content, `no-cache` is the directive to use.\n *\n * The `no-cache` **response directive** indicates that the response can be stored in caches, but\n * the response must be validated with the origin server before each reuse, even when the cache\n * is disconnected from the origin server.\n *\n * `no-cache` allows clients to request the most up-to-date response even if the cache has a\n * [fresh](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#fresh_and_stale_based_on_age)\n * response.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#no-cache)\n */\n noCache?: true\n /**\n * The `no-store` **request directive** allows a client to request that caches refrain from\n * storing the request and corresponding response \u2014 even if the origin server's response could\n * be stored.\n *\n * The `no-store` **response directive** indicates that any caches of any kind (private or shared)\n * should not store this response.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#no-store)\n */\n noStore?: true\n /**\n * `no-transform` indicates that any intermediary (regardless of whether it implements a cache)\n * shouldn't transform the response contents.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#no-transform)\n */\n noTransform?: true\n /**\n * The client indicates that cache should obtain an already-cached response. If a cache has\n * stored a response, it's reused.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#only-if-cached)\n */\n onlyIfCached?: true\n /**\n * The `must-revalidate` **response directive** indicates that the response can be stored in\n * caches and can be reused while [fresh](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#fresh_and_stale_based_on_age).\n * If the response becomes [stale](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#fresh_and_stale_based_on_age),\n * it must be validated with the origin server before reuse.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#must-revalidate)\n */\n mustRevalidate?: true\n /**\n * The `proxy-revalidate` **response directive** is the equivalent of `must-revalidate`, but\n * specifically for shared caches only.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#proxy-revalidate)\n */\n proxyRevalidate?: true\n /**\n * The `must-understand` **response directive** indicates that a cache should store the response\n * only if it understands the requirements for caching based on status code.\n *\n * `must-understand` should be coupled with `no-store` for fallback behavior.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#must-understand)\n */\n mustUnderstand?: true\n /**\n * The `private` **response directive** indicates that the response can be stored only in a\n * private cache (e.g. local caches in browsers).\n *\n * You should add the `private` directive for user-personalized content, especially for responses\n * received after login and for sessions managed via cookies.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#private)\n */\n private?: true\n /**\n * The `public` **response directive** indicates that the response can be stored in a shared\n * cache. Responses for requests with `Authorization` header fields must not be stored in a\n * shared cache; however, the `public` directive will cause such responses to be stored in a\n * shared cache.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#public)\n */\n public?: true\n /**\n * The `immutable` **response directive** indicates that the response will not be updated while\n * it's [fresh](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#fresh_and_stale_based_on_age).\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#public)\n */\n immutable?: true\n /**\n * The `stale-while-revalidate` **response directive** indicates that the cache could reuse a\n * stale response while it revalidates it to a cache.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#stale-while-revalidate)\n */\n staleWhileRevalidate?: number\n /**\n * The `stale-if-error` **response directive** indicates that the cache can reuse a\n * [stale response](https://developer.mozilla.org/en-US/docs/Web/HTTP/Caching#fresh_and_stale_based_on_age)\n * when an upstream server generates an error, or when the error is generated locally. Here, an\n * error is considered any response with a status code of 500, 502, 503, or 504.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control#stale-if-error)\n */\n staleIfError?: number\n}\n\n/**\n * The value of a `Cache-Control` HTTP header.\n *\n * [MDN `Cache-Control` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7234#section-5.2)\n */\nexport class CacheControl implements HeaderValue, CacheControlInit {\n maxAge?: number\n maxStale?: number\n minFresh?: number\n sMaxage?: number\n noCache?: true\n noStore?: true\n noTransform?: true\n onlyIfCached?: true\n mustRevalidate?: true\n proxyRevalidate?: true\n mustUnderstand?: true\n private?: true\n public?: true\n immutable?: true\n staleWhileRevalidate?: number\n staleIfError?: number\n\n constructor(init?: string | CacheControlInit) {\n if (init) {\n if (typeof init === 'string') {\n let params = parseParams(init, ',')\n if (params.length > 0) {\n for (let [name, value] of params) {\n switch (name) {\n case 'max-age':\n this.maxAge = Number(value)\n break\n case 'max-stale':\n this.maxStale = Number(value)\n break\n case 'min-fresh':\n this.minFresh = Number(value)\n break\n case 's-maxage':\n this.sMaxage = Number(value)\n break\n case 'no-cache':\n this.noCache = true\n break\n case 'no-store':\n this.noStore = true\n break\n case 'no-transform':\n this.noTransform = true\n break\n case 'only-if-cached':\n this.onlyIfCached = true\n break\n case 'must-revalidate':\n this.mustRevalidate = true\n break\n case 'proxy-revalidate':\n this.proxyRevalidate = true\n break\n case 'must-understand':\n this.mustUnderstand = true\n break\n case 'private':\n this.private = true\n break\n case 'public':\n this.public = true\n break\n case 'immutable':\n this.immutable = true\n break\n case 'stale-while-revalidate':\n this.staleWhileRevalidate = Number(value)\n break\n case 'stale-if-error':\n this.staleIfError = Number(value)\n break\n }\n }\n }\n } else {\n this.maxAge = init.maxAge\n this.maxStale = init.maxStale\n this.minFresh = init.minFresh\n this.sMaxage = init.sMaxage\n this.noCache = init.noCache\n this.noStore = init.noStore\n this.noTransform = init.noTransform\n this.onlyIfCached = init.onlyIfCached\n this.mustRevalidate = init.mustRevalidate\n this.proxyRevalidate = init.proxyRevalidate\n this.mustUnderstand = init.mustUnderstand\n this.private = init.private\n this.public = init.public\n this.immutable = init.immutable\n this.staleWhileRevalidate = init.staleWhileRevalidate\n this.staleIfError = init.staleIfError\n }\n }\n }\n\n toString(): string {\n let parts = []\n\n if (this.public) {\n parts.push('public')\n }\n if (this.private) {\n parts.push('private')\n }\n if (typeof this.maxAge === 'number') {\n parts.push(`max-age=${this.maxAge}`)\n }\n if (typeof this.sMaxage === 'number') {\n parts.push(`s-maxage=${this.sMaxage}`)\n }\n if (this.noCache) {\n parts.push('no-cache')\n }\n if (this.noStore) {\n parts.push('no-store')\n }\n if (this.noTransform) {\n parts.push('no-transform')\n }\n if (this.onlyIfCached) {\n parts.push('only-if-cached')\n }\n if (this.mustRevalidate) {\n parts.push('must-revalidate')\n }\n if (this.proxyRevalidate) {\n parts.push('proxy-revalidate')\n }\n if (this.mustUnderstand) {\n parts.push('must-understand')\n }\n if (this.immutable) {\n parts.push('immutable')\n }\n if (typeof this.staleWhileRevalidate === 'number') {\n parts.push(`stale-while-revalidate=${this.staleWhileRevalidate}`)\n }\n if (typeof this.staleIfError === 'number') {\n parts.push(`stale-if-error=${this.staleIfError}`)\n }\n if (typeof this.maxStale === 'number') {\n parts.push(`max-stale=${this.maxStale}`)\n }\n if (typeof this.minFresh === 'number') {\n parts.push(`min-fresh=${this.minFresh}`)\n }\n\n return parts.join(', ')\n }\n}\n", "import { type HeaderValue } from './header-value.ts'\nimport { parseParams, quote } from './param-values.ts'\n\nexport interface ContentDispositionInit {\n /**\n * For file uploads, the name of the file that the user selected.\n */\n filename?: string\n /**\n * For file uploads, the name of the file that the user selected, encoded as a [RFC 8187](https://tools.ietf.org/html/rfc8187) `filename*` parameter.\n * This parameter allows non-ASCII characters in filenames, and specifies the character encoding.\n */\n filenameSplat?: string\n /**\n * For `multipart/form-data` requests, the name of the `<input>` field associated with this content.\n */\n name?: string\n /**\n * The disposition type of the content, such as `attachment` or `inline`.\n */\n type?: string\n}\n\n/**\n * The value of a `Content-Disposition` HTTP header.\n *\n * [MDN `Content-Disposition` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition)\n *\n * [RFC 6266](https://tools.ietf.org/html/rfc6266)\n */\nexport class ContentDisposition implements HeaderValue, ContentDispositionInit {\n filename?: string\n filenameSplat?: string\n name?: string\n type?: string\n\n constructor(init?: string | ContentDispositionInit) {\n if (init) {\n if (typeof init === 'string') {\n let params = parseParams(init)\n if (params.length > 0) {\n this.type = params[0][0]\n for (let [name, value] of params.slice(1)) {\n if (name === 'filename') {\n this.filename = value\n } else if (name === 'filename*') {\n this.filenameSplat = value\n } else if (name === 'name') {\n this.name = value\n }\n }\n }\n } else {\n this.filename = init.filename\n this.filenameSplat = init.filenameSplat\n this.name = init.name\n this.type = init.type\n }\n }\n }\n\n /**\n * The preferred filename for the content, using the `filename*` parameter if present, falling back to the `filename` parameter.\n *\n * From [RFC 6266](https://tools.ietf.org/html/rfc6266):\n *\n * Many user agent implementations predating this specification do not understand the \"filename*\" parameter.\n * Therefore, when both \"filename\" and \"filename*\" are present in a single header field value, recipients SHOULD\n * pick \"filename*\" and ignore \"filename\". This way, senders can avoid special-casing specific user agents by\n * sending both the more expressive \"filename*\" parameter, and the \"filename\" parameter as fallback for legacy recipients.\n */\n get preferredFilename(): string | undefined {\n let filenameSplat = this.filenameSplat\n if (filenameSplat) {\n let decodedFilename = decodeFilenameSplat(filenameSplat)\n if (decodedFilename) return decodedFilename\n }\n\n return this.filename\n }\n\n toString(): string {\n if (!this.type) {\n return ''\n }\n\n let parts = [this.type]\n\n if (this.name) {\n parts.push(`name=${quote(this.name)}`)\n }\n if (this.filename) {\n parts.push(`filename=${quote(this.filename)}`)\n }\n if (this.filenameSplat) {\n parts.push(`filename*=${quote(this.filenameSplat)}`)\n }\n\n return parts.join('; ')\n }\n}\n\nfunction decodeFilenameSplat(value: string): string | null {\n let match = value.match(/^([\\w-]+)'([^']*)'(.+)$/)\n if (!match) return null\n\n let [, charset, , encodedFilename] = match\n\n let decodedFilename = percentDecode(encodedFilename)\n\n try {\n let decoder = new TextDecoder(charset)\n let bytes = new Uint8Array(decodedFilename.split('').map((char) => char.charCodeAt(0)))\n return decoder.decode(bytes)\n } catch (error) {\n console.warn(`Failed to decode filename from charset ${charset}:`, error)\n return decodedFilename\n }\n}\n\nfunction percentDecode(value: string): string {\n return value.replace(/\\+/g, ' ').replace(/%([0-9A-Fa-f]{2})/g, (_, hex) => {\n return String.fromCharCode(parseInt(hex, 16))\n })\n}\n", "import { type HeaderValue } from './header-value.ts'\nimport { parseParams, quote } from './param-values.ts'\n\nexport interface ContentTypeInit {\n /**\n * For multipart entities, the boundary that separates the different parts of the message.\n */\n boundary?: string\n /**\n * Indicates the [character encoding](https://developer.mozilla.org/en-US/docs/Glossary/Character_encoding) of the content.\n *\n * For example, `utf-8`, `iso-8859-1`.\n */\n charset?: string\n /**\n * The media type (or MIME type) of the content. This consists of a type and subtype, separated by a slash.\n *\n * For example, `text/html`, `application/json`, `image/png`.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types)\n */\n mediaType?: string\n}\n\n/**\n * The value of a `Content-Type` HTTP header.\n *\n * [MDN `Content-Type` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7231#section-3.1.1.5)\n */\nexport class ContentType implements HeaderValue, ContentTypeInit {\n boundary?: string\n charset?: string\n mediaType?: string\n\n constructor(init?: string | ContentTypeInit) {\n if (init) {\n if (typeof init === 'string') {\n let params = parseParams(init)\n if (params.length > 0) {\n this.mediaType = params[0][0]\n for (let [name, value] of params.slice(1)) {\n if (name === 'boundary') {\n this.boundary = value\n } else if (name === 'charset') {\n this.charset = value\n }\n }\n }\n } else {\n this.boundary = init.boundary\n this.charset = init.charset\n this.mediaType = init.mediaType\n }\n }\n }\n\n toString(): string {\n if (!this.mediaType) {\n return ''\n }\n\n let parts = [this.mediaType]\n\n if (this.charset) {\n parts.push(`charset=${quote(this.charset)}`)\n }\n if (this.boundary) {\n parts.push(`boundary=${quote(this.boundary)}`)\n }\n\n return parts.join('; ')\n }\n}\n", "import { type HeaderValue } from './header-value.ts'\nimport { parseParams, quote } from './param-values.ts'\nimport { isIterable } from './utils.ts'\n\nexport type CookieInit = Iterable<[string, string]> | Record<string, string>\n\n/**\n * The value of a `Cookie` HTTP header.\n *\n * [MDN `Cookie` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cookie)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc6265#section-4.2)\n */\nexport class Cookie implements HeaderValue, Iterable<[string, string]> {\n #map: Map<string, string>\n\n constructor(init?: string | CookieInit) {\n this.#map = new Map()\n if (init) {\n if (typeof init === 'string') {\n let params = parseParams(init)\n for (let [name, value] of params) {\n this.#map.set(name, value ?? '')\n }\n } else if (isIterable(init)) {\n for (let [name, value] of init) {\n this.#map.set(name, value)\n }\n } else {\n for (let name of Object.getOwnPropertyNames(init)) {\n this.#map.set(name, init[name])\n }\n }\n }\n }\n\n /**\n * An array of the names of the cookies in the header.\n */\n get names(): string[] {\n return Array.from(this.#map.keys())\n }\n\n /**\n * An array of the values of the cookies in the header.\n */\n get values(): string[] {\n return Array.from(this.#map.values())\n }\n\n /**\n * The number of cookies in the header.\n */\n get size(): number {\n return this.#map.size\n }\n\n /**\n * Gets the value of a cookie with the given name from the header.\n * @param name The name of the cookie.\n * @returns The value of the cookie, or `null` if the cookie does not exist.\n */\n get(name: string): string | null {\n return this.#map.get(name) ?? null\n }\n\n /**\n * Sets a cookie with the given name and value in the header.\n * @param name The name of the cookie.\n * @param value The value of the cookie.\n */\n set(name: string, value: string): void {\n this.#map.set(name, value)\n }\n\n /**\n * Removes a cookie with the given name from the header.\n * @param name The name of the cookie.\n */\n delete(name: string): void {\n this.#map.delete(name)\n }\n\n /**\n * True if a cookie with the given name exists in the header.\n * @param name The name of the cookie.\n * @returns True if a cookie with the given name exists in the header.\n */\n has(name: string): boolean {\n return this.#map.has(name)\n }\n\n /**\n * Removes all cookies from the header.\n */\n clear(): void {\n this.#map.clear()\n }\n\n entries(): IterableIterator<[string, string]> {\n return this.#map.entries()\n }\n\n [Symbol.iterator](): IterableIterator<[string, string]> {\n return this.entries()\n }\n\n forEach(callback: (name: string, value: string, header: Cookie) => void, thisArg?: any): void {\n for (let [name, value] of this) {\n callback.call(thisArg, name, value, this)\n }\n }\n\n toString(): string {\n let pairs: string[] = []\n\n for (let [name, value] of this.#map) {\n pairs.push(`${name}=${quote(value)}`)\n }\n\n return pairs.join('; ')\n }\n}\n", "import { type HeaderValue } from './header-value.ts'\nimport { quoteEtag } from './utils.ts'\n\nexport interface IfNoneMatchInit {\n /**\n * The entity tags to compare against the current entity.\n */\n tags: string[]\n}\n\n/**\n * The value of an `If-None-Match` HTTP header.\n *\n * [MDN `If-None-Match` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-None-Match)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7232#section-3.2)\n */\nexport class IfNoneMatch implements HeaderValue, IfNoneMatchInit {\n tags: string[] = []\n\n constructor(init?: string | string[] | IfNoneMatchInit) {\n if (init) {\n if (typeof init === 'string') {\n this.tags.push(...init.split(/\\s*,\\s*/).map(quoteEtag))\n } else if (Array.isArray(init)) {\n this.tags.push(...init.map(quoteEtag))\n } else {\n this.tags.push(...init.tags.map(quoteEtag))\n }\n }\n }\n\n /**\n * Checks if the header contains the given entity tag.\n *\n * Note: This method checks only for exact matches and does not consider wildcards.\n *\n * @param tag The entity tag to check for.\n * @returns `true` if the tag is present in the header, `false` otherwise.\n */\n has(tag: string): boolean {\n return this.tags.includes(quoteEtag(tag))\n }\n\n /**\n * Checks if this header matches the given entity tag.\n *\n * @param tag The entity tag to check for.\n * @returns `true` if the tag is present in the header (or the header contains a wildcard), `false` otherwise.\n */\n matches(tag: string): boolean {\n return this.has(tag) || this.tags.includes('*')\n }\n\n toString() {\n return this.tags.join(', ')\n }\n}\n", "import { type HeaderValue } from './header-value.ts'\nimport { parseParams, quote } from './param-values.ts'\nimport { capitalize, isValidDate } from './utils.ts'\n\ntype SameSiteValue = 'Strict' | 'Lax' | 'None'\n\nexport interface SetCookieInit {\n /**\n * The domain of the cookie. For example, `example.com`.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#domaindomain-value)\n */\n domain?: string\n /**\n * The expiration date of the cookie. If not specified, the cookie is a session cookie.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#expiresdate)\n */\n expires?: Date\n /**\n * Indicates this cookie should not be accessible via JavaScript.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#httponly)\n */\n httpOnly?: true\n /**\n * The maximum age of the cookie in seconds.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#max-age)\n */\n maxAge?: number\n /**\n * The name of the cookie.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#cookie-namecookie-value)\n */\n name?: string\n /**\n * The path of the cookie. For example, `/` or `/admin`.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#pathpath-value)\n */\n path?: string\n /**\n * The `SameSite` attribute of the cookie. This attribute lets servers require that a cookie shouldn't be sent with\n * cross-site requests, which provides some protection against cross-site request forgery attacks.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value)\n */\n sameSite?: SameSiteValue\n /**\n * Indicates the cookie should only be sent over HTTPS.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#secure)\n */\n secure?: true\n /**\n * The value of the cookie.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#cookie-namecookie-value)\n */\n value?: string\n}\n\n/**\n * The value of a `Set-Cookie` HTTP header.\n *\n * [MDN `Set-Cookie` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1)\n */\nexport class SetCookie implements HeaderValue, SetCookieInit {\n domain?: string\n expires?: Date\n httpOnly?: true\n maxAge?: number\n name?: string\n path?: string\n sameSite?: SameSiteValue\n secure?: true\n value?: string\n\n constructor(init?: string | SetCookieInit) {\n if (init) {\n if (typeof init === 'string') {\n let params = parseParams(init)\n if (params.length > 0) {\n this.name = params[0][0]\n this.value = params[0][1]\n\n for (let [key, value] of params.slice(1)) {\n switch (key.toLowerCase()) {\n case 'domain':\n this.domain = value\n break\n case 'expires': {\n if (typeof value === 'string') {\n let date = new Date(value)\n if (isValidDate(date)) {\n this.expires = date\n }\n }\n break\n }\n case 'httponly':\n this.httpOnly = true\n break\n case 'max-age': {\n if (typeof value === 'string') {\n let v = parseInt(value, 10)\n if (!isNaN(v)) this.maxAge = v\n }\n break\n }\n case 'path':\n this.path = value\n break\n case 'samesite':\n if (typeof value === 'string' && /strict|lax|none/i.test(value)) {\n this.sameSite = capitalize(value) as SameSiteValue\n }\n break\n case 'secure':\n this.secure = true\n break\n }\n }\n }\n } else {\n this.domain = init.domain\n this.expires = init.expires\n this.httpOnly = init.httpOnly\n this.maxAge = init.maxAge\n this.name = init.name\n this.path = init.path\n this.sameSite = init.sameSite\n this.secure = init.secure\n this.value = init.value\n }\n }\n }\n\n toString(): string {\n if (!this.name) {\n return ''\n }\n\n let parts = [`${this.name}=${quote(this.value || '')}`]\n\n if (this.domain) {\n parts.push(`Domain=${this.domain}`)\n }\n if (this.path) {\n parts.push(`Path=${this.path}`)\n }\n if (this.expires) {\n parts.push(`Expires=${this.expires.toUTCString()}`)\n }\n if (this.maxAge) {\n parts.push(`Max-Age=${this.maxAge}`)\n }\n if (this.secure) {\n parts.push('Secure')\n }\n if (this.httpOnly) {\n parts.push('HttpOnly')\n }\n if (this.sameSite) {\n parts.push(`SameSite=${this.sameSite}`)\n }\n\n return parts.join('; ')\n }\n}\n", "const HeaderWordCasingExceptions: Record<string, string> = {\n ct: 'CT',\n etag: 'ETag',\n te: 'TE',\n www: 'WWW',\n x: 'X',\n xss: 'XSS',\n}\n\nexport function canonicalHeaderName(name: string): string {\n return name\n .toLowerCase()\n .split('-')\n .map((word) => HeaderWordCasingExceptions[word] || word.charAt(0).toUpperCase() + word.slice(1))\n .join('-')\n}\n", "import { type AcceptInit, Accept } from './accept.ts'\nimport { type AcceptEncodingInit, AcceptEncoding } from './accept-encoding.ts'\nimport { type AcceptLanguageInit, AcceptLanguage } from './accept-language.ts'\nimport { type CacheControlInit, CacheControl } from './cache-control.ts'\nimport { type ContentDispositionInit, ContentDisposition } from './content-disposition.ts'\nimport { type ContentTypeInit, ContentType } from './content-type.ts'\nimport { type CookieInit, Cookie } from './cookie.ts'\nimport { canonicalHeaderName } from './header-names.ts'\nimport { type HeaderValue } from './header-value.ts'\nimport { type IfNoneMatchInit, IfNoneMatch } from './if-none-match.ts'\nimport { type SetCookieInit, SetCookie } from './set-cookie.ts'\nimport { isIterable, quoteEtag } from './utils.ts'\n\ntype DateInit = number | Date\n\ninterface SuperHeadersPropertyInit {\n /**\n * The [`Accept`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept) header value.\n */\n accept?: string | AcceptInit\n /**\n * The [`Accept-Encoding`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding) header value.\n */\n acceptEncoding?: string | AcceptEncodingInit\n /**\n * The [`Accept-Language`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language) header value.\n */\n acceptLanguage?: string | AcceptLanguageInit\n /**\n * The [`Accept-Ranges`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Ranges) header value.\n */\n acceptRanges?: string\n /**\n * The [`Age`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Age) header value.\n */\n age?: string | number\n /**\n * The [`Cache-Control`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control) header value.\n */\n cacheControl?: string | CacheControlInit\n /**\n * The [`Connection`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Connection) header value.\n */\n connection?: string\n /**\n * The [`Content-Disposition`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition) header value.\n */\n contentDisposition?: string | ContentDispositionInit\n /**\n * The [`Content-Encoding`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding) header value.\n */\n contentEncoding?: string | string[]\n /**\n * The [`Content-Language`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Language) header value.\n */\n contentLanguage?: string | string[]\n /**\n * The [`Content-Length`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Length) header value.\n */\n contentLength?: string | number\n /**\n * The [`Content-Type`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type) header value.\n */\n contentType?: string | ContentTypeInit\n /**\n * The [`Cookie`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cookie) header value.\n */\n cookie?: string | CookieInit\n /**\n * The [`Date`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Date) header value.\n */\n date?: string | DateInit\n /**\n * The [`ETag`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag) header value.\n */\n etag?: string\n /**\n * The [`Expires`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expires) header value.\n */\n expires?: string | DateInit\n /**\n * The [`Host`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Host) header value.\n */\n host?: string\n /**\n * The [`If-Modified-Since`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Modified-Since) header value.\n */\n ifModifiedSince?: string | DateInit\n /**\n * The [`If-None-Match`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-None-Match) header value.\n */\n ifNoneMatch?: string | string[] | IfNoneMatchInit\n /**\n * The [`If-Unmodified-Since`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Unmodified-Since) header value.\n */\n ifUnmodifiedSince?: string | DateInit\n /**\n * The [`Last-Modified`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified) header value.\n */\n lastModified?: string | DateInit\n /**\n * The [`Location`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location) header value.\n */\n location?: string\n /**\n * The [`Referer`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer) header value.\n */\n referer?: string\n /**\n * The [`Set-Cookie`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie) header value(s).\n */\n setCookie?: string | (string | SetCookieInit)[]\n}\n\nexport type SuperHeadersInit =\n | Iterable<[string, string]>\n | (SuperHeadersPropertyInit & Record<string, string | HeaderValue>)\n\nconst CRLF = '\\r\\n'\n\nconst AcceptKey = 'accept'\nconst AcceptEncodingKey = 'accept-encoding'\nconst AcceptLanguageKey = 'accept-language'\nconst AcceptRangesKey = 'accept-ranges'\nconst AgeKey = 'age'\nconst CacheControlKey = 'cache-control'\nconst ConnectionKey = 'connection'\nconst ContentDispositionKey = 'content-disposition'\nconst ContentEncodingKey = 'content-encoding'\nconst ContentLanguageKey = 'content-language'\nconst ContentLengthKey = 'content-length'\nconst ContentTypeKey = 'content-type'\nconst CookieKey = 'cookie'\nconst DateKey = 'date'\nconst ETagKey = 'etag'\nconst ExpiresKey = 'expires'\nconst HostKey = 'host'\nconst IfModifiedSinceKey = 'if-modified-since'\nconst IfNoneMatchKey = 'if-none-match'\nconst IfUnmodifiedSinceKey = 'if-unmodified-since'\nconst LastModifiedKey = 'last-modified'\nconst LocationKey = 'location'\nconst RefererKey = 'referer'\nconst SetCookieKey = 'set-cookie'\n\n/**\n * An enhanced JavaScript `Headers` interface with type-safe access.\n *\n * [API Reference](https://github.com/remix-run/remix/tree/main/packages/headers)\n *\n * [MDN `Headers` Base Class Reference](https://developer.mozilla.org/en-US/docs/Web/API/Headers)\n */\nexport class SuperHeaders extends Headers {\n #map: Map<string, string | HeaderValue>\n #setCookies: (string | SetCookie)[] = []\n\n constructor(init?: string | SuperHeadersInit | Headers) {\n super()\n\n this.#map = new Map()\n\n if (init) {\n if (typeof init === 'string') {\n let lines = init.split(CRLF)\n for (let line of lines) {\n let match = line.match(/^([^:]+):(.*)/)\n if (match) {\n this.append(match[1].trim(), match[2].trim())\n }\n }\n } else if (isIterable(init)) {\n for (let [name, value] of init) {\n this.append(name, value)\n }\n } else if (typeof init === 'object') {\n for (let name of Object.getOwnPropertyNames(init)) {\n let value = init[name]\n\n let descriptor = Object.getOwnPropertyDescriptor(SuperHeaders.prototype, name)\n if (descriptor?.set) {\n descriptor.set.call(this, value)\n } else {\n this.set(name, value.toString())\n }\n }\n }\n }\n }\n\n /**\n * Appends a new header value to the existing set of values for a header,\n * or adds the header if it does not already exist.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Headers/append)\n */\n append(name: string, value: string): void {\n let key = name.toLowerCase()\n if (key === SetCookieKey) {\n this.#setCookies.push(value)\n } else {\n let existingValue = this.#map.get(key)\n this.#map.set(key, existingValue ? `${existingValue}, ${value}` : value)\n }\n }\n\n /**\n * Removes a header.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Headers/delete)\n */\n delete(name: string): void {\n let key = name.toLowerCase()\n if (key === SetCookieKey) {\n this.#setCookies = []\n } else {\n this.#map.delete(key)\n }\n }\n\n /**\n * Returns a string of all the values for a header, or `null` if the header does not exist.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Headers/get)\n */\n get(name: string): string | null {\n let key = name.toLowerCase()\n if (key === SetCookieKey) {\n return this.getSetCookie().join(', ')\n } else {\n let value = this.#map.get(key)\n if (typeof value === 'string') {\n return value\n } else if (value != null) {\n let str = value.toString()\n return str === '' ? null : str\n } else {\n return null\n }\n }\n }\n\n /**\n * Returns an array of all values associated with the `Set-Cookie` header. This is\n * useful when building headers for a HTTP response since multiple `Set-Cookie` headers\n * must be sent on separate lines.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Headers/getSetCookie)\n */\n getSetCookie(): string[] {\n return this.#setCookies.map((v) => (typeof v === 'string' ? v : v.toString()))\n }\n\n /**\n * Returns `true` if the header is present in the list of headers.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Headers/has)\n */\n has(name: string): boolean {\n let key = name.toLowerCase()\n return key === SetCookieKey ? this.#setCookies.length > 0 : this.get(key) != null\n }\n\n /**\n * Sets a new value for the given header. If the header already exists, the new value\n * will replace the existing value.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Headers/set)\n */\n set(name: string, value: string): void {\n let key = name.toLowerCase()\n if (key === SetCookieKey) {\n this.#setCookies = [value]\n } else {\n this.#map.set(key, value)\n }\n }\n\n /**\n * Returns an iterator of all header keys (lowercase).\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Headers/keys)\n */\n *keys(): HeadersIterator<string> {\n for (let [key] of this) yield key\n }\n\n /**\n * Returns an iterator of all header values.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Headers/values)\n */\n *values(): HeadersIterator<string> {\n for (let [, value] of this) yield value\n }\n\n /**\n * Returns an iterator of all header key/value pairs.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Headers/entries)\n */\n *entries(): HeadersIterator<[string, string]> {\n for (let [key] of this.#map) {\n let str = this.get(key)\n if (str) yield [key, str]\n }\n\n for (let value of this.getSetCookie()) {\n yield [SetCookieKey, value]\n }\n }\n\n [Symbol.iterator](): HeadersIterator<[string, string]> {\n return this.entries()\n }\n\n /**\n * Invokes the `callback` for each header key/value pair.\n *\n * [MDN Reference](https://developer.mozilla.org/en-US/docs/Web/API/Headers/forEach)\n */\n forEach(callback: (value: string, key: string, parent: Headers) => void, thisArg?: any): void {\n for (let [key, value] of this) {\n callback.call(thisArg, value, key, this)\n }\n }\n\n /**\n * Returns a string representation of the headers suitable for use in a HTTP message.\n */\n toString(): string {\n let lines: string[] = []\n\n for (let [key, value] of this) {\n lines.push(`${canonicalHeaderName(key)}: ${value}`)\n }\n\n return lines.join(CRLF)\n }\n\n // Header-specific getters and setters\n\n /**\n * The `Accept` header is used by clients to indicate the media types that are acceptable\n * in the response.\n *\n * [MDN `Accept` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7231#section-5.3.2)\n */\n get accept(): Accept {\n return this.#getHeaderValue(AcceptKey, Accept)\n }\n\n set accept(value: string | AcceptInit | undefined | null) {\n this.#setHeaderValue(AcceptKey, Accept, value)\n }\n\n /**\n * The `Accept-Encoding` header contains information about the content encodings that the client\n * is willing to accept in the response.\n *\n * [MDN `Accept-Encoding` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Encoding)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7231#section-5.3.4)\n */\n get acceptEncoding(): AcceptEncoding {\n return this.#getHeaderValue(AcceptEncodingKey, AcceptEncoding)\n }\n\n set acceptEncoding(value: string | AcceptEncodingInit | undefined | null) {\n this.#setHeaderValue(AcceptEncodingKey, AcceptEncoding, value)\n }\n\n /**\n * The `Accept-Language` header contains information about preferred natural language for the\n * response.\n *\n * [MDN `Accept-Language` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Language)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7231#section-5.3.5)\n */\n get acceptLanguage(): AcceptLanguage {\n return this.#getHeaderValue(AcceptLanguageKey, AcceptLanguage)\n }\n\n set acceptLanguage(value: string | AcceptLanguageInit | undefined | null) {\n this.#setHeaderValue(AcceptLanguageKey, AcceptLanguage, value)\n }\n\n /**\n * The `Accept-Ranges` header indicates the server's acceptance of range requests.\n *\n * [MDN `Accept-Ranges` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Accept-Ranges)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7233#section-2.3)\n */\n get acceptRanges(): string | null {\n return this.#getStringValue(AcceptRangesKey)\n }\n\n set acceptRanges(value: string | undefined | null) {\n this.#setStringValue(AcceptRangesKey, value)\n }\n\n /**\n * The `Age` header contains the time in seconds an object was in a proxy cache.\n *\n * [MDN `Age` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Age)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7234#section-5.1)\n */\n get age(): number | null {\n return this.#getNumberValue(AgeKey)\n }\n\n set age(value: string | number | undefined | null) {\n this.#setNumberValue(AgeKey, value)\n }\n\n /**\n * The `Cache-Control` header contains directives for caching mechanisms in both requests and responses.\n *\n * [MDN `Cache-Control` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7234#section-5.2)\n */\n get cacheControl(): CacheControl {\n return this.#getHeaderValue(CacheControlKey, CacheControl)\n }\n\n set cacheControl(value: string | CacheControlInit | undefined | null) {\n this.#setHeaderValue(CacheControlKey, CacheControl, value)\n }\n\n /**\n * The `Connection` header controls whether the network connection stays open after the current\n * transaction finishes.\n *\n * [MDN `Connection` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Connection)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7230#section-6.1)\n */\n get connection(): string | null {\n return this.#getStringValue(ConnectionKey)\n }\n\n set connection(value: string | undefined | null) {\n this.#setStringValue(ConnectionKey, value)\n }\n\n /**\n * The `Content-Disposition` header is a response-type header that describes how the payload is displayed.\n *\n * [MDN `Content-Disposition` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition)\n *\n * [RFC 6266](https://datatracker.ietf.org/doc/html/rfc6266)\n */\n get contentDisposition(): ContentDisposition {\n return this.#getHeaderValue(ContentDispositionKey, ContentDisposition)\n }\n\n set contentDisposition(value: string | ContentDispositionInit | undefined | null) {\n this.#setHeaderValue(ContentDispositionKey, ContentDisposition, value)\n }\n\n /**\n * The `Content-Encoding` header specifies the encoding of the resource.\n *\n * Note: If multiple encodings have been used, this value may be a comma-separated list. However, most often this\n * header will only contain a single value.\n *\n * [MDN `Content-Encoding` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Encoding)\n *\n * [HTTP/1.1 Specification](https://httpwg.org/specs/rfc9110.html#field.content-encoding)\n */\n get contentEncoding(): string | null {\n return this.#getStringValue(ContentEncodingKey)\n }\n\n set contentEncoding(value: string | string[] | undefined | null) {\n this.#setStringValue(ContentEncodingKey, Array.isArray(value) ? value.join(', ') : value)\n }\n\n /**\n * The `Content-Language` header describes the natural language(s) of the intended audience for the response content.\n *\n * Note: If the response content is intended for multiple audiences, this value may be a comma-separated list. However,\n * most often this header will only contain a single value.\n *\n * [MDN `Content-Language` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Language)\n *\n * [HTTP/1.1 Specification](https://httpwg.org/specs/rfc9110.html#field.content-language)\n */\n get contentLanguage(): string | null {\n return this.#getStringValue(ContentLanguageKey)\n }\n\n set contentLanguage(value: string | string[] | undefined | null) {\n this.#setStringValue(ContentLanguageKey, Array.isArray(value) ? value.join(', ') : value)\n }\n\n /**\n * The `Content-Length` header indicates the size of the entity-body in bytes.\n *\n * [MDN `Content-Length` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Length)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7230#section-3.3.2)\n */\n get contentLength(): number | null {\n return this.#getNumberValue(ContentLengthKey)\n }\n\n set contentLength(value: string | number | undefined | null) {\n this.#setNumberValue(ContentLengthKey, value)\n }\n\n /**\n * The `Content-Type` header indicates the media type of the resource.\n *\n * [MDN `Content-Type` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Type)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7231#section-3.1.1.5)\n */\n get contentType(): ContentType {\n return this.#getHeaderValue(ContentTypeKey, ContentType)\n }\n\n set contentType(value: string | ContentTypeInit | undefined | null) {\n this.#setHeaderValue(ContentTypeKey, ContentType, value)\n }\n\n /**\n * The `Cookie` request header contains stored HTTP cookies previously sent by the server with\n * the `Set-Cookie` header.\n *\n * [MDN `Cookie` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cookie)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc6265#section-5.4)\n */\n get cookie(): Cookie {\n return this.#getHeaderValue(CookieKey, Cookie)\n }\n\n set cookie(value: string | CookieInit | undefined | null) {\n this.#setHeaderValue(CookieKey, Cookie, value)\n }\n\n /**\n * The `Date` header contains the date and time at which the message was sent.\n *\n * [MDN `Date` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Date)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7231#section-7.1.1.2)\n */\n get date(): Date | null {\n return this.#getDateValue(DateKey)\n }\n\n set date(value: string | DateInit | undefined | null) {\n this.#setDateValue(DateKey, value)\n }\n\n /**\n * The `ETag` header provides a unique identifier for the current version of the resource.\n *\n * [MDN `ETag` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7232#section-2.3)\n */\n get etag(): string | null {\n return this.#getStringValue(ETagKey)\n }\n\n set etag(value: string | undefined | null) {\n this.#setStringValue(ETagKey, typeof value === 'string' ? quoteEtag(value) : value)\n }\n\n /**\n * The `Expires` header contains the date/time after which the response is considered stale.\n *\n * [MDN `Expires` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expires)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7234#section-5.3)\n */\n get expires(): Date | null {\n return this.#getDateValue(ExpiresKey)\n }\n\n set expires(value: string | DateInit | undefined | null) {\n this.#setDateValue(ExpiresKey, value)\n }\n\n /**\n * The `Host` header specifies the domain name of the server and (optionally) the TCP port number.\n *\n * [MDN `Host` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Host)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7230#section-5.4)\n */\n get host(): string | null {\n return this.#getStringValue(HostKey)\n }\n\n set host(value: string | undefined | null) {\n this.#setStringValue(HostKey, value)\n }\n\n /**\n * The `If-Modified-Since` header makes a request conditional on the last modification date of the\n * requested resource.\n *\n * [MDN `If-Modified-Since` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Modified-Since)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7232#section-3.3)\n */\n get ifModifiedSince(): Date | null {\n return this.#getDateValue(IfModifiedSinceKey)\n }\n\n set ifModifiedSince(value: string | DateInit | undefined | null) {\n this.#setDateValue(IfModifiedSinceKey, value)\n }\n\n /**\n * The `If-None-Match` header makes a request conditional on the absence of a matching ETag.\n *\n * [MDN `If-None-Match` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-None-Match)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7232#section-3.2)\n */\n get ifNoneMatch(): IfNoneMatch {\n return this.#getHeaderValue(IfNoneMatchKey, IfNoneMatch)\n }\n\n set ifNoneMatch(value: string | string[] | IfNoneMatchInit | undefined | null) {\n this.#setHeaderValue(IfNoneMatchKey, IfNoneMatch, value)\n }\n\n /**\n * The `If-Unmodified-Since` header makes a request conditional on the last modification date of the\n * requested resource.\n *\n * [MDN `If-Unmodified-Since` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Unmodified-Since)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7232#section-3.4)\n */\n get ifUnmodifiedSince(): Date | null {\n return this.#getDateValue(IfUnmodifiedSinceKey)\n }\n\n set ifUnmodifiedSince(value: string | DateInit | undefined | null) {\n this.#setDateValue(IfUnmodifiedSinceKey, value)\n }\n\n /**\n * The `Last-Modified` header contains the date and time at which the resource was last modified.\n *\n * [MDN `Last-Modified` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Last-Modified)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7232#section-2.2)\n */\n get lastModified(): Date | null {\n return this.#getDateValue(LastModifiedKey)\n }\n\n set lastModified(value: string | DateInit | undefined | null) {\n this.#setDateValue(LastModifiedKey, value)\n }\n\n /**\n * The `Location` header indicates the URL to redirect to.\n *\n * [MDN `Location` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Location)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7231#section-7.1.2)\n */\n get location(): string | null {\n return this.#getStringValue(LocationKey)\n }\n\n set location(value: string | undefined | null) {\n this.#setStringValue(LocationKey, value)\n }\n\n /**\n * The `Referer` header contains the address of the previous web page from which a link to the\n * currently requested page was followed.\n *\n * [MDN `Referer` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referer)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc7231#section-5.5.2)\n */\n get referer(): string | null {\n return this.#getStringValue(RefererKey)\n }\n\n set referer(value: string | undefined | null) {\n this.#setStringValue(RefererKey, value)\n }\n\n /**\n * The `Set-Cookie` header is used to send cookies from the server to the user agent.\n *\n * [MDN `Set-Cookie` Reference](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie)\n *\n * [HTTP/1.1 Specification](https://datatracker.ietf.org/doc/html/rfc6265#section-4.1)\n */\n get setCookie(): SetCookie[] {\n let setCookies = this.#setCookies\n\n for (let i = 0; i < setCookies.length; ++i) {\n if (typeof setCookies[i] === 'string') {\n setCookies[i] = new SetCookie(setCookies[i])\n }\n }\n\n return setCookies as SetCookie[]\n }\n\n set setCookie(value: (string | SetCookieInit)[] | string | SetCookieInit | undefined | null) {\n if (value != null) {\n this.#setCookies = (Array.isArray(value) ? value : [value]).map((v) =>\n typeof v === 'string' ? v : new SetCookie(v),\n )\n } else {\n this.#setCookies = []\n }\n }\n\n // Helpers\n\n #getHeaderValue<T extends HeaderValue>(key: string, ctor: new (init?: any) => T): T {\n let value = this.#map.get(key)\n\n if (value !== undefined) {\n if (typeof value === 'string') {\n let obj = new ctor(value)\n this.#map.set(key, obj) // cache the new object\n return obj\n } else {\n return value as T\n }\n }\n\n let obj = new ctor()\n this.#map.set(key, obj) // cache the new object\n return obj\n }\n\n #setHeaderValue(key: string, ctor: new (init?: string) => HeaderValue, value: any): void {\n if (value != null) {\n this.#map.set(key, typeof value === 'string' ? value : new ctor(value))\n } else {\n this.#map.delete(key)\n }\n }\n\n #getDateValue(key: string): Date | null {\n let value = this.#map.get(key)\n return value === undefined ? null : new Date(value as string)\n }\n\n #setDateValue(key: string, value: string | DateInit | undefined | null): void {\n if (value != null) {\n this.#map.set(\n key,\n typeof value === 'string'\n ? value\n : (typeof value === 'number' ? new Date(value) : value).toUTCString(),\n )\n } else {\n this.#map.delete(key)\n }\n }\n\n #getNumberValue(key: string): number | null {\n let value = this.#map.get(key)\n return value === undefined ? null : parseInt(value as string, 10)\n }\n\n #setNumberValue(key: string, value: string | number | undefined | null): void {\n if (value != null) {\n this.#map.set(key, typeof value === 'string' ? value : value.toString())\n } else {\n this.#map.delete(key)\n }\n }\n\n #getStringValue(key: string): string | null {\n let value = this.#map.get(key)\n return value === undefined ? null : (value as string)\n }\n\n #setStringValue(key: string, value: string | undefined | null): void {\n if (value != null) {\n this.#map.set(key, value)\n } else {\n this.#map.delete(key)\n }\n }\n}\n", "// We need this little helper for environments that do not support\n// ReadableStream.prototype[Symbol.asyncIterator] yet. See #46\nexport async function* readStream(stream: ReadableStream<Uint8Array>): AsyncIterable<Uint8Array> {\n let reader = stream.getReader()\n\n try {\n while (true) {\n let result = await reader.read()\n if (result.done) break\n yield result.value\n }\n } finally {\n reader.releaseLock()\n }\n}\n", "export interface SearchFunction {\n (haystack: Uint8Array, start?: number): number\n}\n\nexport function createSearch(pattern: string): SearchFunction {\n let needle = new TextEncoder().encode(pattern)\n\n let search: SearchFunction\n if ('Buffer' in globalThis && !('Bun' in globalThis || 'Deno' in globalThis)) {\n // Use the built-in Buffer.indexOf method on Node.js for better perf.\n search = (haystack, start = 0) => Buffer.prototype.indexOf.call(haystack, needle, start)\n } else {\n let needleEnd = needle.length - 1\n let skipTable = new Uint8Array(256).fill(needle.length)\n for (let i = 0; i < needleEnd; ++i) {\n skipTable[needle[i]] = needleEnd - i\n }\n\n search = (haystack, start = 0) => {\n let haystackLength = haystack.length\n let i = start + needleEnd\n\n while (i < haystackLength) {\n for (let j = needleEnd, k = i; j >= 0 && haystack[k] === needle[j]; --j, --k) {\n if (j === 0) return k\n }\n\n i += skipTable[haystack[i]]\n }\n\n return -1\n }\n }\n\n return search\n}\n\nexport interface PartialTailSearchFunction {\n (haystack: Uint8Array): number\n}\n\nexport function createPartialTailSearch(pattern: string): PartialTailSearchFunction {\n let needle = new TextEncoder().encode(pattern)\n\n let byteIndexes: Record<number, number[]> = {}\n for (let i = 0; i < needle.length; ++i) {\n let byte = needle[i]\n if (byteIndexes[byte] === undefined) byteIndexes[byte] = []\n byteIndexes[byte].push(i)\n }\n\n return function (haystack: Uint8Array): number {\n let haystackEnd = haystack.length - 1\n\n if (haystack[haystackEnd] in byteIndexes) {\n let indexes = byteIndexes[haystack[haystackEnd]]\n\n for (let i = indexes.length - 1; i >= 0; --i) {\n for (let j = indexes[i], k = haystackEnd; j >= 0 && haystack[k] === needle[j]; --j, --k) {\n if (j === 0) return k\n }\n }\n }\n\n return -1\n }\n}\n", "import Headers from '@remix-run/headers'\n\nimport { readStream } from './read-stream.ts'\nimport type { SearchFunction, PartialTailSearchFunction } from './buffer-search.ts'\nimport { createSearch, createPartialTailSearch } from './buffer-search.ts'\n\n/**\n * The base class for errors thrown by the multipart parser.\n */\nexport class MultipartParseError extends Error {\n constructor(message: string) {\n super(message)\n this.name = 'MultipartParseError'\n }\n}\n\n/**\n * An error thrown when the maximum allowed size of a header is exceeded.\n */\nexport class MaxHeaderSizeExceededError extends MultipartParseError {\n constructor(maxHeaderSize: number) {\n super(`Multipart header size exceeds maximum allowed size of ${maxHeaderSize} bytes`)\n this.name = 'MaxHeaderSizeExceededError'\n }\n}\n\n/**\n * An error thrown when the maximum allowed size of a file is exceeded.\n */\nexport class MaxFileSizeExceededError extends MultipartParseError {\n constructor(maxFileSize: number) {\n super(`File size exceeds maximum allowed size of ${maxFileSize} bytes`)\n this.name = 'MaxFileSizeExceededError'\n }\n}\n\nexport interface ParseMultipartOptions {\n /**\n * The boundary string used to separate parts in the multipart message,\n * e.g. the `boundary` parameter in the `Content-Type` header.\n */\n boundary: string\n /**\n * The maximum allowed size of a header in bytes. If an individual part's header\n * exceeds this size, a `MaxHeaderSizeExceededError` will be thrown.\n *\n * Default: 8 KiB\n */\n maxHeaderSize?: number\n /**\n * The maximum allowed size of a file in bytes. If an individual part's content\n * exceeds this size, a `MaxFileSizeExceededError` will be thrown.\n *\n * Default: 2 MiB\n */\n maxFileSize?: number\n}\n\n/**\n * Parse a `multipart/*` message from a buffer/iterable and yield each part as a `MultipartPart` object.\n *\n * Note: This is a low-level API that requires manual handling of the content and boundary. If you're\n * building a web server, consider using `parseMultipartRequest(request)` instead.\n *\n * @param message The multipart message as a `Uint8Array` or an iterable of `Uint8Array` chunks\n * @param options Options for the parser\n * @return A generator that yields `MultipartPart` objects\n */\nexport function* parseMultipart(\n message: Uint8Array | Iterable<Uint8Array>,\n options: ParseMultipartOptions,\n): Generator<MultipartPart, void, unknown> {\n let parser = new MultipartParser(options.boundary, {\n maxHeaderSize: options.maxHeaderSize,\n maxFileSize: options.maxFileSize,\n })\n\n if (message instanceof Uint8Array) {\n if (message.length === 0) {\n return // No data to parse\n }\n\n yield* parser.write(message)\n } else {\n for (let chunk of message) {\n yield* parser.write(chunk)\n }\n }\n\n parser.finish()\n}\n\n/**\n * Parse a `multipart/*` message stream and yield each part as a `MultipartPart` object.\n *\n * Note: This is a low-level API that requires manual handling of the content and boundary. If you're\n * building a web server, consider using `parseMultipartRequest(request)` instead.\n *\n * @param stream A stream containing multipart data as a `ReadableStream<Uint8Array>`\n * @param options Options for the parser\n * @return An async generator that yields `MultipartPart` objects\n */\nexport async function* parseMultipartStream(\n stream: ReadableStream<Uint8Array>,\n options: ParseMultipartOptions,\n): AsyncGenerator<MultipartPart, void, unknown> {\n let parser = new MultipartParser(options.boundary, {\n maxHeaderSize: options.maxHeaderSize,\n maxFileSize: options.maxFileSize,\n })\n\n for await (let chunk of readStream(stream)) {\n if (chunk.length === 0) {\n continue // No data to parse\n }\n\n yield* parser.write(chunk)\n }\n\n parser.finish()\n}\n\nexport type MultipartParserOptions = Omit<ParseMultipartOptions, 'boundary'>\n\nconst MultipartParserStateStart = 0\nconst MultipartParserStateAfterBoundary = 1\nconst MultipartParserStateHeader = 2\nconst MultipartParserStateBody = 3\nconst MultipartParserStateDone = 4\n\nconst findDoubleNewline = createSearch('\\r\\n\\r\\n')\n\nconst oneKb = 1024\nconst oneMb = 1024 * oneKb\n\n/**\n * A streaming parser for `multipart/*` HTTP messages.\n */\nexport class MultipartParser {\n readonly boundary: string\n readonly maxHeaderSize: number\n readonly maxFileSize: number\n\n #findOpeningBoundary: SearchFunction\n #openingBoundaryLength: number\n #findBoundary: SearchFunction\n #findPartialTailBoundary: PartialTailSearchFunction\n #boundaryLength: number\n\n #state = MultipartParserStateStart\n #buffer: Uint8Array | null = null\n #currentPart: MultipartPart | null = null\n #contentLength = 0\n\n constructor(boundary: string, options?: MultipartParserOptions) {\n this.boundary = boundary\n this.maxHeaderSize = options?.maxHeaderSize ?? 8 * oneKb\n this.maxFileSize = options?.maxFileSize ?? 2 * oneMb\n\n this.#findOpeningBoundary = createSearch(`--${boundary}`)\n this.#openingBoundaryLength = 2 + boundary.length // length of '--' + boundary\n this.#findBoundary = createSearch(`\\r\\n--${boundary}`)\n this.#findPartialTailBoundary = createPartialTailSearch(`\\r\\n--${boundary}`)\n this.#boundaryLength = 4 + boundary.length // length of '\\r\\n--' + boundary\n }\n\n /**\n * Write a chunk of data to the parser.\n *\n * @param chunk A chunk of data to write to the parser\n * @return A generator yielding `MultipartPart` objects as they are parsed\n */\n *write(chunk: Uint8Array): Generator<MultipartPart, void, unknown> {\n if (this.#state === MultipartParserStateDone) {\n throw new MultipartParseError('Unexpected data after end of stream')\n }\n\n let index = 0\n let chunkLength = chunk.length\n\n if (this.#buffer !== null) {\n let newChunk = new Uint8Array(this.#buffer.length + chunkLength)\n newChunk.set(this.#buffer, 0)\n newChunk.set(chunk, this.#buffer.length)\n chunk = newChunk\n chunkLength = chunk.length\n this.#buffer = null\n }\n\n while (true) {\n if (this.#state === MultipartParserStateBody) {\n if (chunkLength - index < this.#boundaryLength) {\n this.#buffer = chunk.subarray(index)\n break\n }\n\n let boundaryIndex = this.#findBoundary(chunk, index)\n\n if (boundaryIndex === -1) {\n // No boundary found, but there may be a partial match at the end of the chunk.\n let partialTailIndex = this.#findPartialTailBoundary(chunk)\n\n if (partialTailIndex === -1) {\n this.#append(index === 0 ? chunk : chunk.subarray(index))\n } else {\n this.#append(chunk.subarray(index, partialTailIndex))\n this.#buffer = chunk.subarray(partialTailIndex)\n }\n\n break\n }\n\n this.#append(chunk.subarray(index, boundaryIndex))\n\n yield this.#currentPart!\n\n index = boundaryIndex + this.#boundaryLength\n\n this.#state = MultipartParserStateAfterBoundary\n }\n\n if (this.#state === MultipartParserStateAfterBoundary) {\n if (chunkLength - index < 2) {\n this.#buffer = chunk.subarray(index)\n break\n }\n\n if (chunk[index] === 45 && chunk[index + 1] === 45) {\n this.#state = MultipartParserStateDone\n break\n }\n\n index += 2 // Skip \\r\\n after boundary\n\n this.#state = MultipartParserStateHeader\n }\n\n if (this.#state === MultipartParserStateHeader) {\n if (chunkLength - index < 4) {\n this.#buffer = chunk.subarray(index)\n break\n }\n\n let headerEndIndex = findDoubleNewline(chunk, index)\n\n if (headerEndIndex === -1) {\n if (chunkLength - index > this.maxHeaderSize) {\n throw new MaxHeaderSizeExceededError(this.maxHeaderSize)\n }\n\n this.#buffer = chunk.subarray(index)\n break\n }\n\n if (headerEndIndex - index > this.maxHeaderSize) {\n throw new MaxHeaderSizeExceededError(this.maxHeaderSize)\n }\n\n this.#currentPart = new MultipartPart(chunk.subarray(index, headerEndIndex), [])\n this.#contentLength = 0\n\n index = headerEndIndex + 4 // Skip header + \\r\\n\\r\\n\n\n this.#state = MultipartParserStateBody\n\n continue\n }\n\n if (this.#state === MultipartParserStateStart) {\n if (chunkLength < this.#openingBoundaryLength) {\n this.#buffer = chunk\n break\n }\n\n if (this.#findOpeningBoundary(chunk) !== 0) {\n throw new MultipartParseError('Invalid multipart stream: missing initial boundary')\n }\n\n index = this.#openingBoundaryLength\n\n this.#state = MultipartParserStateAfterBoundary\n }\n }\n }\n\n #append(chunk: Uint8Array): void {\n if (this.#contentLength + chunk.length > this.maxFileSize) {\n throw new MaxFileSizeExceededError(this.maxFileSize)\n }\n\n this.#currentPart!.content.push(chunk)\n this.#contentLength += chunk.length\n }\n\n /**\n * Should be called after all data has been written to the parser.\n *\n * Note: This will throw if the multipart message is incomplete or\n * wasn't properly terminated.\n *\n * @return void\n */\n finish(): void {\n if (this.#state !== MultipartParserStateDone) {\n throw new MultipartParseError('Multipart stream not finished')\n }\n }\n}\n\nconst decoder = new TextDecoder('utf-8', { fatal: true })\n\n/**\n * A part of a `multipart/*` HTTP message.\n */\nexport class MultipartPart {\n /**\n * The raw content of this part as an array of `Uint8Array` chunks.\n */\n readonly content: Uint8Array[]\n\n #header: Uint8Array\n #headers?: Headers\n\n constructor(header: Uint8Array, content: Uint8Array[]) {\n this.#header = header\n this.content = content\n }\n\n /**\n * The content of this part as an `ArrayBuffer`.\n */\n get arrayBuffer(): ArrayBuffer {\n return this.bytes.buffer as ArrayBuffer\n }\n\n /**\n * The content of this part as a single `Uint8Array`. In `multipart/form-data` messages, this is useful\n * for reading the value of files that were uploaded using `<input type=\"file\">` fields.\n */\n get bytes(): Uint8Array {\n let buffer = new Uint8Array(this.size)\n\n let offset = 0\n for (let chunk of this.content) {\n buffer.set(chunk, offset)\n offset += chunk.length\n }\n\n return buffer\n }\n\n /**\n * The headers associated with this part.\n */\n get headers(): Headers {\n if (!this.#headers) {\n this.#headers = new Headers(decoder.decode(this.#header))\n }\n\n return this.#headers\n }\n\n /**\n * True if this part originated from a file upload.\n */\n get isFile(): boolean {\n return this.filename !== undefined || this.mediaType === 'application/octet-stream'\n }\n\n /**\n * True if this part originated from a text input field in a form submission.\n */\n get isText(): boolean {\n return !this.isFile\n }\n\n /**\n * The filename of the part, if it is a file upload.\n */\n get filename(): string | undefined {\n return this.headers.contentDisposition.preferredFilename\n }\n\n /**\n * The media type of the part.\n */\n get mediaType(): string | undefined {\n return this.headers.contentType.mediaType\n }\n\n /**\n * The name of the part, usually the `name` of the field in the `<form>` that submitted the request.\n */\n get name(): string | undefined {\n return this.headers.contentDisposition.name\n }\n\n /**\n * The size of the content in bytes.\n */\n get size(): number {\n let size = 0\n\n for (let chunk of this.content) {\n size += chunk.length\n }\n\n return size\n }\n\n /**\n * The content of this part as a string. In `multipart/form-data` messages, this is useful for\n * reading the value of parts that originated from `<input type=\"text\">` fields.\n *\n * Note: Do not use this for binary data, use `part.bytes` or `part.arrayBuffer` instead.\n */\n get text(): string {\n return decoder.decode(this.bytes)\n }\n}\n", "import type { MultipartParserOptions, MultipartPart } from './multipart.ts'\nimport { MultipartParseError, parseMultipartStream } from './multipart.ts'\n\n/**\n * Extracts the boundary string from a `multipart/*` content type.\n *\n * @param contentType The `Content-Type` header value from the request\n * @return The boundary string if found, or null if not present\n */\nexport function getMultipartBoundary(contentType: string): string | null {\n let match = /boundary=(?:\"([^\"]+)\"|([^;]+))/i.exec(contentType)\n return match ? (match[1] ?? match[2]) : null\n}\n\n/**\n * Returns true if the given request contains multipart data.\n *\n * @param request The `Request` object to check\n * @return `true` if the request is a multipart request, `false` otherwise\n */\nexport function isMultipartRequest(request: Request): boolean {\n let contentType = request.headers.get('Content-Type')\n return contentType != null && contentType.startsWith('multipart/')\n}\n\n/**\n * Parse a multipart [`Request`](https://developer.mozilla.org/en-US/docs/Web/API/Request) and yield each part as\n * a `MultipartPart` object. Useful in HTTP server contexts for handling incoming `multipart/*` requests.\n *\n * @param request The `Request` object containing multipart data\n * @param options Optional parser options, such as `maxHeaderSize` and `maxFileSize`\n * @return An async generator yielding `MultipartPart` objects\n */\nexport async function* parseMultipartRequest(\n request: Request,\n options?: MultipartParserOptions,\n): AsyncGenerator<MultipartPart, void, unknown> {\n if (!isMultipartRequest(request)) {\n throw new MultipartParseError('Request is not a multipart request')\n }\n if (!request.body) {\n throw new MultipartParseError('Request body is empty')\n }\n\n let boundary = getMultipartBoundary(request.headers.get('Content-Type')!)\n if (!boundary) {\n throw new MultipartParseError('Invalid Content-Type header: missing boundary')\n }\n\n yield* parseMultipartStream(request.body, {\n boundary,\n maxHeaderSize: options?.maxHeaderSize,\n maxFileSize: options?.maxFileSize,\n })\n}\n"],
|
|
5
|
+
"mappings": ";AAAO,SAAS,YACd,OACA,YAAuB,KACS;AAGhC,MAAI,SACF,cAAc,MACV,6EACA;AAEN,MAAI,SAAyC,CAAC;AAE9C,MAAI;AACJ,UAAQ,QAAQ,OAAO,KAAK,KAAK,OAAO,MAAM;AAC5C,QAAI,MAAM,MAAM,CAAC,EAAE,KAAK;AAExB,QAAI;AACJ,QAAI,MAAM,CAAC,GAAG;AACZ,eAAS,MAAM,CAAC,KAAK,MAAM,CAAC,KAAK,IAAI,QAAQ,UAAU,IAAI,EAAE,KAAK;AAAA,IACpE;AAEA,WAAO,KAAK,CAAC,KAAK,KAAK,CAAC;AAAA,EAC1B;AAEA,SAAO;AACT;A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C9D,SAAO,QAAS,MAAM,CAAC,KAAK,MAAM,CAAC,IAAK;AAC1C;AAQO,SAAS,mBAAmB,SAA2B;AAC5D,MAAI,cAAc,QAAQ,QAAQ,IAAI,cAAc;AACpD,SAAO,eAAe,QAAQ,YAAY,WAAW,YAAY;AACnE;AAUA,gBAAuB,sBACrB,SACA,SAC8C;AAC9C,MAAI,CAAC,mBAAmB,OAAO,GAAG;AAChC,UAAM,IAAI,oBAAoB,oCAAoC;AAAA,EACpE;AACA,MAAI,CAAC,QAAQ,MAAM;AACjB,UAAM,IAAI,oBAAoB,uBAAuB;AAAA,EACvD;AAEA,MAAI,WAAW,qBAAqB,QAAQ,QAAQ,IAAI,cAAc,CAAE;AACxE,MAAI,CAAC,UAAU;AACb,UAAM,IAAI,oBAAoB,+CAA+C;AAAA,EAC/E;AAEA,SAAO,qBAAqB,QAAQ,MAAM;AAAA,IACxC;AAAA,IACA,eAAe,SAAS;AAAA,IACxB,aAAa,SAAS;AAAA,EACxB,CAAC;AACH;",
|
|
6
|
+
"names": ["decoder", "obj"]
|
|
7
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"buffer-search.d.ts","sourceRoot":"","sources":["../../src/lib/buffer-search.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,CAAC,QAAQ,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"buffer-search.d.ts","sourceRoot":"","sources":["../../src/lib/buffer-search.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,CAAC,QAAQ,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAC/C;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,cAAc,CA+B5D;AAED,MAAM,WAAW,yBAAyB;IACxC,CAAC,QAAQ,EAAE,UAAU,GAAG,MAAM,CAAA;CAC/B;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,yBAAyB,CAyBlF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multipart-request.d.ts","sourceRoot":"","sources":["../../src/lib/multipart-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,gBAAgB,
|
|
1
|
+
{"version":3,"file":"multipart-request.d.ts","sourceRoot":"","sources":["../../src/lib/multipart-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAG3E;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGvE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAG5D;AAED;;;;;;;GAOG;AACH,wBAAuB,qBAAqB,CAC1C,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,cAAc,CAAC,aAAa,EAAE,IAAI,EAAE,OAAO,CAAC,CAkB9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multipart.d.ts","sourceRoot":"","sources":["../../src/lib/multipart.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"multipart.d.ts","sourceRoot":"","sources":["../../src/lib/multipart.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,oBAAoB,CAAA;AAMxC;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;gBAChC,OAAO,EAAE,MAAM;CAI5B;AAED;;GAEG;AACH,qBAAa,0BAA2B,SAAQ,mBAAmB;gBACrD,aAAa,EAAE,MAAM;CAIlC;AAED;;GAEG;AACH,qBAAa,wBAAyB,SAAQ,mBAAmB;gBACnD,WAAW,EAAE,MAAM;CAIh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AI,UAAU,CAUtB;IAED;;OAEG;IACH,IAAI,OAAO,IAAI,OAAO,CAMrB;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED;;OAEG;IACH,IAAI,MAAM,IAAI,OAAO,CAEpB;IAED;;OAEG;IACH,IAAI,QAAQ,IAAI,MAAM,GAAG,SAAS,CAEjC;IAED;;OAEG;IACH,IAAI,SAAS,IAAI,MAAM,GAAG,SAAS,CAElC;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,GAAG,SAAS,CAE7B;IAED;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAQjB;IAED;;;;;OAKG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"multipart.node.d.ts","sourceRoot":"","sources":["../../src/lib/multipart.node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,IAAI,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"multipart.node.d.ts","sourceRoot":"","sources":["../../src/lib/multipart.node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,IAAI,MAAM,WAAW,CAAA;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC,OAAO,KAAK,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAQlG;;;;;;;;;GASG;AACH,wBAAiB,cAAc,CAC7B,OAAO,EAAE,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,EAClC,OAAO,EAAE,qBAAqB,GAC7B,SAAS,CAAC,aAAa,EAAE,IAAI,EAAE,OAAO,CAAC,CAEzC;AAED;;;;;;;;;GASG;AACH,wBAAuB,oBAAoB,CACzC,MAAM,EAAE,QAAQ,EAChB,OAAO,EAAE,qBAAqB,GAC7B,cAAc,CAAC,aAAa,EAAE,IAAI,EAAE,OAAO,CAAC,CAE9C;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,IAAI,CAAC,eAAe,GAAG,OAAO,CAGrE;AAED;;;;;;GAMG;AACH,wBAAuB,qBAAqB,CAC1C,GAAG,EAAE,IAAI,CAAC,eAAe,EACzB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,cAAc,CAAC,aAAa,EAAE,IAAI,EAAE,OAAO,CAAC,CAe9C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type { ParseMultipartOptions, MultipartParserOptions } from './lib/multipart.ts';
|
|
2
2
|
export { MultipartParseError, MaxHeaderSizeExceededError, MaxFileSizeExceededError, MultipartParser, MultipartPart, } from './lib/multipart.ts';
|
|
3
3
|
export { getMultipartBoundary } from './lib/multipart-request.ts';
|
|
4
|
-
export { isMultipartRequest, parseMultipartRequest, parseMultipart, parseMultipartStream } from './lib/multipart.node.ts';
|
|
5
|
-
//# sourceMappingURL=
|
|
4
|
+
export { isMultipartRequest, parseMultipartRequest, parseMultipart, parseMultipartStream, } from './lib/multipart.node.ts';
|
|
5
|
+
//# sourceMappingURL=node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AACA,YAAY,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAA;AACvF,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,wBAAwB,EACxB,eAAe,EACf,aAAa,GACd,MAAM,oBAAoB,CAAA;AAE3B,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAA;AAGjE,OAAO,EACL,kBAAkB,EAClB,qBAAqB,EACrB,cAAc,EACd,oBAAoB,GACrB,MAAM,yBAAyB,CAAA"}
|
|
@@ -1604,9 +1604,9 @@ async function* readStream(stream) {
|
|
|
1604
1604
|
let reader = stream.getReader();
|
|
1605
1605
|
try {
|
|
1606
1606
|
while (true) {
|
|
1607
|
-
|
|
1608
|
-
if (done) break;
|
|
1609
|
-
yield value;
|
|
1607
|
+
let result = await reader.read();
|
|
1608
|
+
if (result.done) break;
|
|
1609
|
+
yield result.value;
|
|
1610
1610
|
}
|
|
1611
1611
|
} finally {
|
|
1612
1612
|
reader.releaseLock();
|
|
@@ -1988,4 +1988,4 @@ export {
|
|
|
1988
1988
|
parseMultipartRequest,
|
|
1989
1989
|
parseMultipartStream2 as parseMultipartStream
|
|
1990
1990
|
};
|
|
1991
|
-
//# sourceMappingURL=
|
|
1991
|
+
//# sourceMappingURL=node.js.map
|