export class FileData {
    constructor(file, data) {
        this.data = null;
        if (file instanceof File) {
            this.file = file;
            this.fileName = file.name;
        }
        else {
            this.fileUrl = file;
        }
        if (data) {
            this.data = data;
        }
        if (!data) {
            if (this.file) {
                const reader = new FileReader();
                reader.onload = (event) => {
                    var _a;
                    this.data = ((_a = event.target) === null || _a === void 0 ? void 0 : _a.result) || null;
                };
                reader.readAsDataURL(this.file);
            }
            else if (this.fileUrl) {
                fetch(this.fileUrl)
                    .then((d) => d.text())
                    .then((t) => {
                    this.data = t;
                });
            }
        }
    }
    getFileData() {
        return this.data;
    }
}
//# sourceMappingURL=FileData.js.map