@ztimson/utils / files
files
Functions
downloadFile()
downloadFile(
blob
,name
):void
Download blob as a file
Parameters
• blob: string
| string
[] | Blob
File as a blob
• name: string
Name blob will be downloaded as
Returns
void
Defined in
src/files.ts:11
downloadUrl()
downloadUrl(
href
,name
?):void
Download a file from a URL
Parameters
• href: any
URL that will be downloaded
• name?: string
Override download name
Returns
void
Defined in
src/files.ts:24
fileBrowser()
fileBrowser(
options
):Promise
<File
[]>
Open filebrowser & return selected file
Parameters
• options = {}
accept - selectable mimetypes, multiple - Allow selecting more than 1 file
• options.accept?: string
• options.multiple?: boolean
Returns
Promise
<File
[]>
Array of selected files
Defined in
src/files.ts:39
timestampFilename()
timestampFilename(
name
?,date
?):string
Create timestamp intended for filenames from a date
Parameters
• name?: string
Name of file, {{TIMESTAMP}}
will be replaced
• date?: string
| number
| Date
= ...
Date to use for timestamp
Returns
string
Interpolated filename, or the raw timestamp if name was omitted
Defined in
src/files.ts:62
uploadWithProgress()
uploadWithProgress<
T
>(options
):PromiseProgress
<T
>
Upload file to URL with progress callback using PromiseProgress
Type Parameters
• T
Parameters
• options
• options.files: File
[]
• options.headers?
• options.url: string
• options.withCredentials?: boolean
Returns
Promise of request with onProgress
callback
Defined in
src/files.ts:74