UNPKG

@nasriya/hypercloud

Version:

Nasriya HyperCloud is a lightweight Node.js HTTP2 framework.

24 lines (23 loc) 741 B
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')); } } export default UploadedMemoryFile;