@intentjs/hyper-express
Version:
A fork of hyper-express to suit IntentJS requirements. High performance Node.js webserver with a simple-to-use API powered by uWebsockets.js under the hood.
40 lines (31 loc) • 724 B
JavaScript
const fs = require('fs');
class UploadedFile {
_filename;
_sizeInBytes;
_mimeType;
_tempName;
_tempPath;
constructor(filename, size, mimeType, tempName, tempPath) {
this._filename = filename;
this._sizeInBytes = size;
this._mimeType = mimeType;
this._tempName = tempName;
this._tempPath = tempPath;
}
get filename() {
return this._filename;
}
get sizeInBytes() {
return this._sizeInBytes;
}
get mimeType() {
return this._mimeType;
}
get extension() {
return this.filename;
}
async toBuffer() {
return fs.readFileSync(this.tempPath);
}
}
module.exports = UploadedFile;