UNPKG

@nasriya/hypercloud

Version:

Nasriya HyperCloud is a lightweight Node.js HTTP2 framework.

26 lines (25 loc) 821 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); class UploadedMemoryFile { #_data = { fieldName: '', fileName: '', mime: '', content: [], size: 0 }; constructor(options) { this.#_data.fieldName = options.fieldName; this.#_data.fileName = options.fileName; this.#_data.mime = options.mime; } get fieldName() { return this.#_data.fieldName; } get fileName() { return this.#_data.fileName; } get mime() { return this.#_data.mime; } get size() { return Buffer.from(this.#_data.content.join()).byteLength; } get content() { return Buffer.concat(this.#_data.content); } push(chunk) { this.#_data.content.push(Buffer.from(chunk, 'binary')); } } exports.default = UploadedMemoryFile;