UNPKG

@uploadx/core

Version:
34 lines (33 loc) 893 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ConfigHandler = void 0; const utils_1 = require("../utils"); class ConfigHandler { constructor() { this._config = this.set(ConfigHandler.defaults); } set(config = {}) { return Object.assign(this._config ?? {}, config); } get() { return this._config; } } exports.ConfigHandler = ConfigHandler; ConfigHandler.defaults = { allowMIME: ['*/*'], maxUploadSize: '5TB', filename: ({ id }) => id, useRelativeLocation: false, onComplete: (file) => file, onUpdate: (file) => file, onCreate: () => '', onDelete: () => '', onError: ({ statusCode, body, headers }) => { return { statusCode, body: { error: body }, headers }; }, path: '/files', validation: {}, maxMetadataSize: '4MB', logger: utils_1.logger };