chayns-components
Version:
A set of beautiful React components for developing chayns® applications.
22 lines (20 loc) • 650 B
JavaScript
;
exports.__esModule = true;
exports.default = fileInputCall;
async function fileInputCall() {
const uploadResult = await chayns.uploadCloudImage();
const matches = uploadResult.url.match(/(\.[a-z]+)/g);
const type = matches && matches.length ? matches[matches.length - 1] : '';
const response = await fetch(uploadResult.url);
const data = await response.blob();
const metadata = {
type: `image/${type.slice(1)}`
};
const file = new File([data], `androidCompatibilityUpload${type}`, metadata);
return {
target: {
files: [file]
}
}; // compatibility event
}
//# sourceMappingURL=fileInputCall.js.map