Skip to main content

sdk.automation.getdatafromfileinput

Home > @matterway/sdk > Automation > getDataFromFileInput

Automation.getDataFromFileInput() function

Returns the files attached to a file input.

Signature:

export declare function getDataFromFileInput(ctx: Context, selector: string, options?: WaitForSelectorOptions): Promise<File[]>;

Parameters

ParameterTypeDescription
ctxContextContext object.
selectorstringSelector for File Input element.
optionsWaitForSelectorOptions(Optional)

Returns:

Promise<File[]>

The file as an Array of blobs for files contained in element.

Example

const attachments = await getDataFromFileInput(ctx, '.attachment');
const pdfs = attachments.filter(f => f.type === 'application/pdf');
const invoices = pdfs.filter(f => f.name.startsWith('invoice-'));
// ...