sdk.file_2.filefromurl
Home > @matterway/sdk > File_2 > fileFromUrl
File_2.fileFromUrl() function
Reads a file from a URL and returns an SdkFile
object that contains the file data and metadata.
Signature:
export declare function fileFromUrl(ctx: Context, url: string): Promise<SdkFile>;
Parameters
Parameter | Type | Description |
---|---|---|
ctx | Context | The Matterway SDK context. |
url | string | The URL of the file to be read. |
Returns:
Promise<SdkFile>
An SdkFile
object that contains the file data and metadata.
Example
const fileUrl = 'https://example.com/files/example.pdf'; const file = await fileFromUrl(context, fileUrl); // Now you can use the file
object as needed.