createFileFromUrl
Create a File object from a remote URL.
Description
This is a client-side helper — it does not call the OneEntry API. It fetches the resource at url, wraps it in a Blob, and returns a File object you can then pass to upload(). It returns a Promise that resolves to a File.
FileUploading.createFileFromUrl(
url*,
filename*,
mimeType
);
Parameters schema
Schema
url(required): string
The URL to fetch the file from
example: "https://example.com/photo.jpg"
filename(required): string
The name to give the created file
example: "photo.jpg"
mimeType: string
Optional MIME type for the file. Defaults to the fetched resource's type.
example: "image/jpeg"
Examples
Minimal example
const file = await FileUploading.createFileFromUrl(
'https://example.com/photo.jpg',
'photo.jpg'
);
// Then upload it to OneEntry cloud storage
const uploaded = await FileUploading.upload(file);
Example response
Returns a standard File object:
File {
name: "photo.jpg",
type: "image/jpeg",
size: 204800
}