({ filepath, originalFilename, mimetype, newFilename })
| 518 | } |
| 519 | |
| 520 | async _newFile({ filepath, originalFilename, mimetype, newFilename }) { |
| 521 | if (this.options.fileWriteStreamHandler) { |
| 522 | return new VolatileFile({ |
| 523 | newFilename, |
| 524 | filepath, |
| 525 | originalFilename, |
| 526 | mimetype, |
| 527 | createFileWriteStream: this.options.fileWriteStreamHandler, |
| 528 | hashAlgorithm: this.options.hashAlgorithm, |
| 529 | }); |
| 530 | } |
| 531 | if (this.options.createDirsFromUploads) { |
| 532 | try { |
| 533 | await createNecessaryDirectoriesAsync(filepath); |
| 534 | } catch (errorCreatingDir) { |
| 535 | this._error(new FormidableError( |
| 536 | `cannot create directory`, |
| 537 | errors.cannotCreateDir, |
| 538 | 409, |
| 539 | )); |
| 540 | } |
| 541 | } |
| 542 | return new PersistentFile({ |
| 543 | newFilename, |
| 544 | filepath, |
| 545 | originalFilename, |
| 546 | mimetype, |
| 547 | hashAlgorithm: this.options.hashAlgorithm, |
| 548 | }); |
| 549 | } |
| 550 | |
| 551 | _getFileName(headerValue) { |
| 552 | // matches either a quoted-string or a token (RFC 2616 section 19.5.1) |
no test coverage detected