graphql-upload 11.0.0 → 14.0.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 CHANGED
@@ -4,434 +4,56 @@
4
4
 
5
5
  [![npm version](https://badgen.net/npm/v/graphql-upload)](https://npm.im/graphql-upload) [![CI status](https://github.com/jaydenseric/graphql-upload/workflows/CI/badge.svg)](https://github.com/jaydenseric/graphql-upload/actions)
6
6
 
7
- Middleware and an [`Upload` scalar](#class-graphqlupload) to add support for [GraphQL multipart requests](https://github.com/jaydenseric/graphql-multipart-request-spec) (file uploads via queries and mutations) to various Node.js GraphQL servers.
7
+ Middleware and an [`Upload`](./GraphQLUpload.js) scalar to add support for [GraphQL multipart requests](https://github.com/jaydenseric/graphql-multipart-request-spec) (file uploads via queries and mutations) to various Node.js GraphQL servers.
8
8
 
9
- ⚠️ Previously published as [`apollo-upload-server`](https://npm.im/apollo-upload-server).
9
+ ## Installation
10
10
 
11
- ## Support
11
+ First, check if there are [GraphQL multipart request spec server implementations](https://github.com/jaydenseric/graphql-multipart-request-spec#server) (most for Node.js integrate [`graphql-upload`](https://npm.im/graphql-upload)) that are more suitable for your environment than a manual setup.
12
12
 
13
- The following environments are known to be compatible:
13
+ To install [`graphql-upload`](https://npm.im/graphql-upload) and the [`graphql`](https://npm.im/graphql) peer dependency with [npm](https://npmjs.com/get-npm), run:
14
14
 
15
- - [Node.js](https://nodejs.org) `^10.13.0 || ^12.0.0 || >= 13.7.0`
16
- - [Koa](https://koajs.com)
17
- - [`graphql-api-koa`](https://npm.im/graphql-api-koa)
18
- - [`koa-graphql`](https://npm.im/koa-graphql)
19
- - [`apollo-server-koa`](https://npm.im/apollo-server-koa) (inbuilt)
20
- - [Express](https://expressjs.com)
21
- - [`express-graphql`](https://npm.im/express-graphql)
22
- - [`apollo-server-express`](https://npm.im/apollo-server-express) (inbuilt)
23
-
24
- See also [GraphQL multipart request spec server implementations](https://github.com/jaydenseric/graphql-multipart-request-spec#server).
25
-
26
- ## Setup
27
-
28
- Setup is necessary if your environment doesn’t feature this package inbuilt (see **_[Support](#support)_**).
29
-
30
- To install [`graphql-upload`](https://npm.im/graphql-upload) and the [`graphql`](https://npm.im/graphql) peer dependency from [npm](https://npmjs.com) run:
31
-
32
- ```shell
15
+ ```sh
33
16
  npm install graphql-upload graphql
34
17
  ```
35
18
 
36
- Use the [`graphqlUploadKoa`](#function-graphqluploadkoa) or [`graphqlUploadExpress`](#function-graphqluploadexpress) middleware just before GraphQL middleware. Alternatively, use [`processRequest`](#function-processrequest) to create custom middleware.
19
+ Use the [`graphqlUploadKoa`](./graphqlUploadKoa.js) or [`graphqlUploadExpress`](./graphqlUploadExpress.js) middleware just before GraphQL middleware. Alternatively, use [`processRequest`](./processRequest.js) to create custom middleware.
37
20
 
38
- A schema built with separate SDL and resolvers (e.g. using [`makeExecutableSchema`](https://apollographql.com/docs/graphql-tools/generate-schema#makeExecutableSchema)) requires the [`Upload` scalar](#class-graphqlupload) to be setup.
21
+ A schema built with separate SDL and resolvers (e.g. using [`makeExecutableSchema`](https://www.graphql-tools.com/docs/api/modules/schema_src#makeexecutableschema) from [`@graphql-tools/schema`](https://npm.im/@graphql-tools/schema)) requires the [`Upload`](./GraphQLUpload.js) scalar to be setup.
39
22
 
40
23
  ## Usage
41
24
 
42
- [Clients implementing the GraphQL multipart request spec](https://github.com/jaydenseric/graphql-multipart-request-spec#client) upload files as [`Upload` scalar](#class-graphqlupload) query or mutation variables. Their resolver values are promises that resolve [file upload details](#type-fileupload) for processing and storage. Files are typically streamed into cloud storage but may also be stored in the filesystem.
25
+ [Clients implementing the GraphQL multipart request spec](https://github.com/jaydenseric/graphql-multipart-request-spec#client) upload files as [`Upload`](./GraphQLUpload.js) scalar query or mutation variables. Their resolver values are promises that resolve file upload details for processing and storage. Files are typically streamed into cloud storage but may also be stored in the filesystem.
43
26
 
44
27
  See the [example API and client](https://github.com/jaydenseric/apollo-upload-examples).
45
28
 
46
29
  ### Tips
47
30
 
48
- - The process must have both read and write access to the directory identified by [`os.tmpdir()`](https://nodejs.org/api/os.html#os_os_tmpdir).
31
+ - The process must have both read and write access to the directory identified by [`os.tmpdir()`](https://nodejs.org/api/os.html#ostmpdir).
49
32
  - The device requires sufficient disk space to buffer the expected number of concurrent upload requests.
50
33
  - Promisify and await file upload streams in resolvers or the server will send a response to the client before uploads are complete, causing a disconnect.
51
34
  - Handle file upload promise rejection and stream errors; uploads sometimes fail due to network connectivity issues or impatient users disconnecting.
52
- - Process multiple uploads asynchronously with [`Promise.all`](https://developer.mozilla.org/en-US/docs/web/javascript/reference/global_objects/promise/all) or a more flexible solution such as [`Promise.allSettled`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled) where an error in one does not reject them all.
53
- - Only use [`createReadStream()`](#type-fileupload) _before_ the resolver returns; late calls (e.g. in an unawaited async function or callback) throw an error. Existing streams can still be used after a response is sent, although there are few valid reasons for not awaiting their completion.
54
- - Use [`stream.destroy()`](https://nodejs.org/api/stream.html#stream_readable_destroy_error) when an incomplete stream is no longer needed, or temporary files may not get cleaned up.
35
+ - Process multiple uploads asynchronously with [`Promise.all`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all) or a more flexible solution such as [`Promise.allSettled`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled) where an error in one does not reject them all.
36
+ - Only use the function `createReadStream` _before_ the resolver returns; late calls (e.g. in an unawaited async function or callback) throw an error. Existing streams can still be used after a response is sent, although there are few valid reasons for not awaiting their completion.
37
+ - Use [`stream.destroy()`](https://nodejs.org/api/stream.html#readabledestroyerror) when an incomplete stream is no longer needed, or temporary files may not get cleaned up.
55
38
 
56
39
  ## Architecture
57
40
 
58
41
  The [GraphQL multipart request spec](https://github.com/jaydenseric/graphql-multipart-request-spec) allows a file to be used for multiple query or mutation variables (file deduplication), and for variables to be used in multiple places. GraphQL resolvers need to be able to manage independent file streams. As resolvers are executed asynchronously, it’s possible they will try to process files in a different order than received in the multipart request.
59
42
 
60
- [`busboy`](https://npm.im/busboy) parses multipart request streams. Once the `operations` and `map` fields have been parsed, [`Upload` scalar](#class-graphqlupload) values in the GraphQL operations are populated with promises, and the operations are passed down the middleware chain to GraphQL resolvers.
61
-
62
- [`fs-capacitor`](https://npm.im/fs-capacitor) is used to buffer file uploads to the filesystem and coordinate simultaneous reading and writing. As soon as a file upload’s contents begins streaming, its data begins buffering to the filesystem and its associated promise resolves. GraphQL resolvers can then create new streams from the buffer by calling [`createReadStream()`](#type-fileupload). The buffer is destroyed once all streams have ended or closed and the server has responded to the request. Any remaining buffer files will be cleaned when the process exits.
63
-
64
- ## API
65
-
66
- ### Table of contents
67
-
68
- - [class GraphQLUpload](#class-graphqlupload)
69
- - [class Upload](#class-upload)
70
- - [Upload instance method reject](#upload-instance-method-reject)
71
- - [Upload instance method resolve](#upload-instance-method-resolve)
72
- - [Upload instance property file](#upload-instance-property-file)
73
- - [Upload instance property promise](#upload-instance-property-promise)
74
- - [function graphqlUploadExpress](#function-graphqluploadexpress)
75
- - [function graphqlUploadKoa](#function-graphqluploadkoa)
76
- - [function processRequest](#function-processrequest)
77
- - [type FileUpload](#type-fileupload)
78
- - [type FileUploadCreateReadStream](#type-fileuploadcreatereadstream)
79
- - [type GraphQLOperation](#type-graphqloperation)
80
- - [type ProcessRequestFunction](#type-processrequestfunction)
81
- - [type ProcessRequestOptions](#type-processrequestoptions)
82
-
83
- ### class GraphQLUpload
84
-
85
- A GraphQL `Upload` scalar that can be used in a [`GraphQLSchema`](https://graphql.org/graphql-js/type/#graphqlschema). It’s value in resolvers is a promise that resolves [file upload details](#type-fileupload) for processing and storage.
86
-
87
- #### Examples
88
-
89
- _Ways to `import`._
90
-
91
- > ```js
92
- > import { GraphQLUpload } from 'graphql-upload';
93
- > ```
94
- >
95
- > ```js
96
- > import GraphQLUpload from 'graphql-upload/public/GraphQLUpload.js';
97
- > ```
98
-
99
- _Ways to `require`._
100
-
101
- > ```js
102
- > const { GraphQLUpload } = require('graphql-upload');
103
- > ```
104
- >
105
- > ```js
106
- > const GraphQLUpload = require('graphql-upload/public/GraphQLUpload');
107
- > ```
108
-
109
- _Setup for a schema built with [`makeExecutableSchema`](https://apollographql.com/docs/graphql-tools/generate-schema#makeExecutableSchema)._
110
-
111
- > ```js
112
- > const { makeExecutableSchema } = require('graphql-tools');
113
- > const { GraphQLUpload } = require('graphql-upload');
114
- >
115
- > const schema = makeExecutableSchema({
116
- > typeDefs: /* GraphQL */ `
117
- > scalar Upload
118
- > `,
119
- > resolvers: {
120
- > Upload: GraphQLUpload,
121
- > },
122
- > });
123
- > ```
124
-
125
- _A manually constructed schema with an image upload mutation._
126
-
127
- > ```js
128
- > const {
129
- > GraphQLSchema,
130
- > GraphQLObjectType,
131
- > GraphQLBoolean,
132
- > } = require('graphql');
133
- > const { GraphQLUpload } = require('graphql-upload');
134
- >
135
- > const schema = new GraphQLSchema({
136
- > mutation: new GraphQLObjectType({
137
- > name: 'Mutation',
138
- > fields: {
139
- > uploadImage: {
140
- > description: 'Uploads an image.',
141
- > type: GraphQLBoolean,
142
- > args: {
143
- > image: {
144
- > description: 'Image file.',
145
- > type: GraphQLUpload,
146
- > },
147
- > },
148
- > async resolve(parent, { image }) {
149
- > const { filename, mimetype, createReadStream } = await image;
150
- > const stream = createReadStream();
151
- > // Promisify the stream and store the file, then…
152
- > return true;
153
- > },
154
- > },
155
- > },
156
- > }),
157
- > });
158
- > ```
159
-
160
- ---
161
-
162
- ### class Upload
163
-
164
- A file expected to be uploaded as it has been declared in the `map` field of a [GraphQL multipart request](https://github.com/jaydenseric/graphql-multipart-request-spec). The [`processRequest`](#function-processrequest) function places references to an instance of this class wherever the file is expected in the [GraphQL operation](#type-graphqloperation). The [`Upload` scalar](#class-graphqlupload) derives it’s value from the [`promise`](#upload-instance-property-promise) property.
165
-
166
- #### Examples
167
-
168
- _Ways to `import`._
169
-
170
- > ```js
171
- > import { Upload } from 'graphql-upload';
172
- > ```
173
- >
174
- > ```js
175
- > import Upload from 'graphql-upload/public/Upload.js';
176
- > ```
177
-
178
- _Ways to `require`._
179
-
180
- > ```js
181
- > const { Upload } = require('graphql-upload');
182
- > ```
183
- >
184
- > ```js
185
- > const Upload = require('graphql-upload/public/Upload');
186
- > ```
187
-
188
- #### Upload instance method reject
189
-
190
- Rejects the upload promise with an error. This should only be utilized by [`processRequest`](#function-processrequest).
191
-
192
- | Parameter | Type | Description |
193
- | :-------- | :----- | :-------------- |
194
- | `error` | object | Error instance. |
195
-
196
- #### Upload instance method resolve
197
-
198
- Resolves the upload promise with the file upload details. This should only be utilized by [`processRequest`](#function-processrequest).
199
-
200
- | Parameter | Type | Description |
201
- | :-------- | :----------------------------- | :------------------- |
202
- | `file` | [FileUpload](#type-fileupload) | File upload details. |
203
-
204
- #### Upload instance property file
205
-
206
- The file upload details, available when the [upload promise](#upload-instance-property-promise) resolves. This should only be utilized by [`processRequest`](#function-processrequest).
207
-
208
- **Type:** `undefined` | [FileUpload](#type-fileupload)
209
-
210
- #### Upload instance property promise
211
-
212
- Promise that resolves file upload details. This should only be utilized by [`GraphQLUpload`](#class-graphqlupload).
213
-
214
- **Type:** Promise<[FileUpload](#type-fileupload)>
215
-
216
- ---
217
-
218
- ### function graphqlUploadExpress
219
-
220
- Creates [Express](https://expressjs.com) middleware that processes [GraphQL multipart requests](https://github.com/jaydenseric/graphql-multipart-request-spec) using [`processRequest`](#function-processrequest), ignoring non-multipart requests. It sets the request body to be [similar to a conventional GraphQL POST request](#type-graphqloperation) for following GraphQL middleware to consume.
221
-
222
- | Parameter | Type | Description |
223
- | :-- | :-- | :-- |
224
- | `options` | [ProcessRequestOptions](#type-processrequestoptions) | Middleware options. Any [`ProcessRequestOptions`](#type-processrequestoptions) can be used. |
225
- | `options.processRequest` | [ProcessRequestFunction](#type-processrequestfunction)? = [processRequest](#function-processrequest) | Used to process [GraphQL multipart requests](https://github.com/jaydenseric/graphql-multipart-request-spec). |
226
-
227
- **Returns:** Function — Express middleware.
228
-
229
- #### Examples
230
-
231
- _Ways to `import`._
232
-
233
- > ```js
234
- > import { graphqlUploadExpress } from 'graphql-upload';
235
- > ```
236
- >
237
- > ```js
238
- > import graphqlUploadExpress from 'graphql-upload/public/graphqlUploadExpress.js';
239
- > ```
240
-
241
- _Ways to `require`._
242
-
243
- > ```js
244
- > const { graphqlUploadExpress } = require('graphql-upload');
245
- > ```
246
- >
247
- > ```js
248
- > const graphqlUploadExpress = require('graphql-upload/public/graphqlUploadExpress');
249
- > ```
250
-
251
- _Basic [`express-graphql`](https://npm.im/express-graphql) setup._
252
-
253
- > ```js
254
- > const express = require('express');
255
- > const graphqlHTTP = require('express-graphql');
256
- > const { graphqlUploadExpress } = require('graphql-upload');
257
- > const schema = require('./schema');
258
- >
259
- > express()
260
- > .use(
261
- > '/graphql',
262
- > graphqlUploadExpress({ maxFileSize: 10000000, maxFiles: 10 }),
263
- > graphqlHTTP({ schema })
264
- > )
265
- > .listen(3000);
266
- > ```
267
-
268
- ---
269
-
270
- ### function graphqlUploadKoa
271
-
272
- Creates [Koa](https://koajs.com) middleware that processes [GraphQL multipart requests](https://github.com/jaydenseric/graphql-multipart-request-spec) using [`processRequest`](#function-processrequest), ignoring non-multipart requests. It sets the request body to be [similar to a conventional GraphQL POST request](#type-graphqloperation) for following GraphQL middleware to consume.
273
-
274
- | Parameter | Type | Description |
275
- | :-- | :-- | :-- |
276
- | `options` | [ProcessRequestOptions](#type-processrequestoptions) | Middleware options. Any [`ProcessRequestOptions`](#type-processrequestoptions) can be used. |
277
- | `options.processRequest` | [ProcessRequestFunction](#type-processrequestfunction)? = [processRequest](#function-processrequest) | Used to process [GraphQL multipart requests](https://github.com/jaydenseric/graphql-multipart-request-spec). |
278
-
279
- **Returns:** Function — Koa middleware.
280
-
281
- #### Examples
282
-
283
- _Ways to `import`._
284
-
285
- > ```js
286
- > import { graphqlUploadKoa } from 'graphql-upload';
287
- > ```
288
- >
289
- > ```js
290
- > import graphqlUploadKoa from 'graphql-upload/public/graphqlUploadKoa.js';
291
- > ```
292
-
293
- _Ways to `require`._
294
-
295
- > ```js
296
- > const { graphqlUploadKoa } = require('graphql-upload');
297
- > ```
298
- >
299
- > ```js
300
- > const graphqlUploadKoa = require('graphql-upload/public/graphqlUploadKoa');
301
- > ```
302
-
303
- _Basic [`graphql-api-koa`](https://npm.im/graphql-api-koa) setup._
304
-
305
- > ```js
306
- > const Koa = require('koa');
307
- > const bodyParser = require('koa-bodyparser');
308
- > const { errorHandler, execute } = require('graphql-api-koa');
309
- > const { graphqlUploadKoa } = require('graphql-upload');
310
- > const schema = require('./schema');
311
- >
312
- > new Koa()
313
- > .use(errorHandler())
314
- > .use(bodyParser())
315
- > .use(graphqlUploadKoa({ maxFileSize: 10000000, maxFiles: 10 }))
316
- > .use(execute({ schema }))
317
- > .listen(3000);
318
- > ```
319
-
320
- ---
321
-
322
- ### function processRequest
323
-
324
- Processes a [GraphQL multipart request](https://github.com/jaydenseric/graphql-multipart-request-spec). It parses the `operations` and `map` fields to create an [`Upload`](#class-upload) instance for each expected file upload, placing references wherever the file is expected in the [GraphQL operation](#type-graphqloperation) for the [`Upload` scalar](#class-graphqlupload) to derive it’s value. Errors are created with [`http-errors`](https://npm.im/http-errors) to assist in sending responses with appropriate HTTP status codes. Used in [`graphqlUploadExpress`](#function-graphqluploadexpress) and [`graphqlUploadKoa`](#function-graphqluploadkoa) and can be used to create custom middleware.
325
-
326
- **Type:** [ProcessRequestFunction](#type-processrequestfunction)
327
-
328
- #### Examples
329
-
330
- _Ways to `import`._
331
-
332
- > ```js
333
- > import { processRequest } from 'graphql-upload';
334
- > ```
335
- >
336
- > ```js
337
- > import processRequest from 'graphql-upload/public/processRequest.js';
338
- > ```
339
-
340
- _Ways to `require`._
341
-
342
- > ```js
343
- > const { processRequest } = require('graphql-upload');
344
- > ```
345
- >
346
- > ```js
347
- > const processRequest = require('graphql-upload/public/processRequest');
348
- > ```
349
-
350
- ---
351
-
352
- ### type FileUpload
353
-
354
- File upload details that are only available after the file’s field in the [GraphQL multipart request](https://github.com/jaydenseric/graphql-multipart-request-spec) has begun streaming in.
355
-
356
- **Type:** object
357
-
358
- | Property | Type | Description |
359
- | :-- | :-- | :-- |
360
- | `filename` | string | File name. |
361
- | `mimetype` | string | File MIME type. Provided by the client and can’t be trusted. |
362
- | `encoding` | string | File stream transfer encoding. |
363
- | `createReadStream` | [FileUploadCreateReadStream](#type-fileuploadcreatereadstream) | Creates a [Node.js readable stream](https://nodejs.org/api/stream.html#stream_readable_streams) of the file’s contents, for processing and storage. |
364
-
365
- ---
366
-
367
- ### type FileUploadCreateReadStream
368
-
369
- Creates a [Node.js readable stream](https://nodejs.org/api/stream.html#stream_readable_streams) of an [uploading file’s](#type-fileupload) contents, for processing and storage. Multiple calls create independent streams. Throws if called after all resolvers have resolved, or after an error has interrupted the request.
370
-
371
- **Type:** Function
372
-
373
- | Parameter | Type | Description |
374
- | :-- | :-- | :-- |
375
- | `options` | object? | [`fs-capacitor`](https://npm.im/fs-capacitor) [`ReadStreamOptions`](https://github.com/mike-marcacci/fs-capacitor#readstreamoptions). |
376
- | `options.encoding` | string? = `null` | Specify an encoding for the [`data`](https://nodejs.org/api/stream.html#stream_event_data) chunks to be strings (without splitting multi-byte characters across chunks) instead of Node.js [`Buffer`](https://nodejs.org/api/buffer.html#buffer_buffer) instances. Supported values depend on the [`Buffer` implementation](https://github.com/nodejs/node/blob/v13.7.0/lib/buffer.js#L587-L663) and include `utf8`, `ucs2`, `utf16le`, `latin1`, `ascii`, `base64`, or `hex`. |
377
- | `options.highWaterMark` | number? = `16384` | Maximum number of bytes to store in the internal buffer before ceasing to read from the underlying resource. |
378
-
379
- **Returns:** Readable — [Node.js readable stream](https://nodejs.org/api/stream.html#stream_readable_streams) of the file’s contents.
380
-
381
- #### See
382
-
383
- - [Node.js `Readable` stream constructor docs](https://nodejs.org/api/stream.html#stream_new_stream_readable_options).
384
- - [Node.js stream backpressure guide](https://nodejs.org/es/docs/guides/backpressuring-in-streams).
385
-
386
- ---
387
-
388
- ### type GraphQLOperation
389
-
390
- A GraphQL operation object in a shape that can be consumed and executed by most GraphQL servers.
391
-
392
- **Type:** object
393
-
394
- | Property | Type | Description |
395
- | :-- | :-- | :-- |
396
- | `query` | string | GraphQL document containing queries and fragments. |
397
- | `operationName` | string \| `null`? | GraphQL document operation name to execute. |
398
- | `variables` | object \| `null`? | GraphQL document operation variables and values map. |
399
-
400
- #### See
401
-
402
- - [GraphQL over HTTP spec](https://github.com/APIs-guru/graphql-over-http#request-parameters).
403
- - [Apollo Server POST requests](https://www.apollographql.com/docs/apollo-server/requests#postRequests).
404
-
405
- ---
406
-
407
- ### type ProcessRequestFunction
408
-
409
- Processes a [GraphQL multipart request](https://github.com/jaydenseric/graphql-multipart-request-spec).
410
-
411
- **Type:** Function
412
-
413
- | Parameter | Type | Description |
414
- | :-- | :-- | :-- |
415
- | `request` | IncomingMessage | [Node.js HTTP server request instance](https://nodejs.org/api/http.html#http_class_http_incomingmessage). |
416
- | `response` | ServerResponse | [Node.js HTTP server response instance](https://nodejs.org/api/http.html#http_class_http_serverresponse). |
417
- | `options` | [ProcessRequestOptions](#type-processrequestoptions)? | Options for processing the request. |
418
-
419
- **Returns:** Promise<[GraphQLOperation](#type-graphqloperation) | Array<[GraphQLOperation](#type-graphqloperation)>> — GraphQL operation or batch of operations for a GraphQL server to consume (usually as the request body).
420
-
421
- #### See
43
+ [`busboy`](https://npm.im/busboy) parses multipart request streams. Once the `operations` and `map` fields have been parsed, [`Upload`](./GraphQLUpload.js) scalar values in the GraphQL operations are populated with promises, and the operations are passed down the middleware chain to GraphQL resolvers.
422
44
 
423
- - [`processRequest`](#function-processrequest).
45
+ [`fs-capacitor`](https://npm.im/fs-capacitor) is used to buffer file uploads to the filesystem and coordinate simultaneous reading and writing. As soon as a file upload’s contents begins streaming, its data begins buffering to the filesystem and its associated promise resolves. GraphQL resolvers can then create new streams from the buffer by calling the function `createReadStream`. The buffer is destroyed once all streams have ended or closed and the server has responded to the request. Any remaining buffer files will be cleaned when the process exits.
424
46
 
425
- ---
47
+ ## Requirements
426
48
 
427
- ### type ProcessRequestOptions
49
+ - [Node.js](https://nodejs.org): `^14.17.0 || ^16.0.0 || >= 18.0.0`
428
50
 
429
- Options for processing a [GraphQL multipart request](https://github.com/jaydenseric/graphql-multipart-request-spec); mostly relating to security, performance and limits.
51
+ ## Exports
430
52
 
431
- **Type:** object
53
+ These CommonJS modules are published to [npm](https://npmjs.com) and exported via the [`package.json`](./package.json) `exports` field:
432
54
 
433
- | Property | Type | Description |
434
- | :-- | :-- | :-- |
435
- | `maxFieldSize` | number? = `1000000` | Maximum allowed non-file multipart form field size in bytes; enough for your queries. |
436
- | `maxFileSize` | number? = Infinity | Maximum allowed file size in bytes. |
437
- | `maxFiles` | number? = Infinity | Maximum allowed number of files. |
55
+ - [`GraphQLUpload.js`](./GraphQLUpload.js)
56
+ - [`graphqlUploadExpress.js`](./graphqlUploadExpress.js)
57
+ - [`graphqlUploadKoa.js`](./graphqlUploadKoa.js)
58
+ - [`processRequest.js`](./processRequest.js)
59
+ - [`Upload.js`](./Upload.js)