Parse multipart/form-data request bodies, providing the parsed object as req.body and req.files.
Configuration:
The options passed are merged with multiparty's Form object, allowing you to configure the upload directory, size limits, etc. For example if you wish to change the upload dir do the following.
app.use(connect.multipart({ uploadDir: path }));
Options:
limit byte limit defaulting to [100mb]
defer defers processing and exposes the multiparty form object as req.form.
next() is called without waiting for the form's "end" event.
This option is useful if you need to bind to the "progress" or "part" events, for example.
Temporary Files:
By default temporary files are used, stored in os.tmpDir(). These are not automatically garbage collected, you are in charge of moving them or deleting them. When defer is not used and these files are created you may refernce them via the req.files object.
Multipart:
Status: Deprecated. The multipart parser will be removed in Connect 3.0.
Please use one of the following parsers/middleware directly:
Parse multipart/form-data request bodies,
providing the parsed object as
req.body
and
req.files
.Configuration:
The options passed are merged with multiparty's
Form
object, allowing you to configure the upload directory,size limits, etc. For example if you wish to change the upload dir do the following.
Options:
limit
byte limit defaulting to [100mb]defer
defers processing and exposes the multiparty form object asreq.form
.next()
is called without waiting for the form's "end" event. This option is useful if you need to bind to the "progress" or "part" events, for example.Temporary Files:
By default temporary files are used, stored in
os.tmpDir()
. Theseare not automatically garbage collected, you are in charge of moving them
or deleting them. When
defer
is not used and these files are created youmay refernce them via the
req.files
object.It is highly recommended to monitor and clean up tempfiles in any production
environment, you may use tools like reap
to do so.
Streaming:
When
defer
is used files are not streamed to tmpfiles, you mayaccess them via the "part" events and stream them accordingly:
Source