UNPKG

@plteam/chat-ui

Version:

CUI Kit is a free and open-source library for creating AI assistant chat interfaces, built with React, Material UI, and TypeScript

14 lines (13 loc) 412 B
const loadUrlFile = async (url) => { try { const response = await fetch(url, { headers: { 'Range': 'bytes=0-1048576' } }); const blob = await response.blob(); const name = url.split('/').pop() || 'file'; return new File([blob], name, { type: blob.type }); } catch (e) { console.error(e); } return undefined; }; export default loadUrlFile;