UNPKG

551 BJavaScriptView Raw
1const assert = require ('assert');
2const UploadAction = require ('./upload-action');
3
4/**
5 * @class SingleFileUploadAction
6 *
7 * Action for uploading a single file. The file is expected to be part of a
8 * multipart/form-data request.
9 */
10module.exports = UploadAction.extend ({
11 /// The name of the field that will contain the uploaded file.
12 name: null,
13
14 init () {
15 this._super.call (this, ...arguments);
16
17 assert (!!this.name, "You must define the 'name' property.");
18
19 this._middleware = this._upload.single (this.name);
20 }
21});