@ginstone/nga-api
Version:
29 lines (28 loc) • 1.05 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.UploadBody = void 0;
const StrUtils_1 = require("../../utils/StrUtils");
const AttachmentUtils_1 = require("../../utils/AttachmentUtils");
class UploadBody {
constructor(raw, file, description) {
this.file = file;
this.description = description;
this.attachments = raw.attachments;
this.attachments_check = raw.attachments_check;
this.isImg = raw.isImg;
this.thumb = raw.thumb;
this.url = raw.url;
this.extension = (0, StrUtils_1.getExtension)(raw.url);
const blobUrl = window.URL.createObjectURL(file);
this.view = {
size: Math.floor(file.size / 1000),
src: blobUrl,
bbsCodes: AttachmentUtils_1.AttachmentUtils.getBbsCodes(this.url, raw.thumb, file.name),
extension: this.extension,
description: this.description,
filename: file.name,
url: blobUrl
};
}
}
exports.UploadBody = UploadBody;