File manager - Edit - /home/c14075/dragmet-ural.ru/www/bitrix/js/landing/imagecompressor/src/internal/url-to-blob.js
Back
import {Type, ajax} from 'main.core'; export default function urlToBlob(url) { if (!Type.isString(url)) { return Promise.resolve(url); } return new Promise((resolve, reject) => { try { const xhr = ajax.xhr(); xhr.open('GET', url); xhr.responseType = 'blob'; xhr.onerror = () => { reject(new Error('Network error.')); }; xhr.onload = () => { if (xhr.status === 200) { resolve(xhr.response); } else { reject(new Error(`Loading error: ${xhr.statusText}`)); } }; xhr.send(); } catch (err) { reject(err.message); } }); }
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.28 |
proxy
|
phpinfo
|
Settings