html2app • JS Bridge
    Preparing search index...

    Variable FilePickerConst

    FilePicker: {
        pickFile(
            options?: FilePickerOptions,
        ): Promise<MessageResponse<{ file: PickedFile | null }>>;
        pickFiles(
            options?: FilePickerOptions,
        ): Promise<MessageResponse<{ files: PickedFile[] }>>;
    } = ...

    File picker plugin for choosing any file from the device.

    Type Declaration

    Android only for now. Requires the file_picker plugin to be enabled in the app configuration.

    • The system file browser opens, and each chosen file is returned as a PickedFile with a localhost URL.
    • Use allowedExtensions to limit the choice. Invalid extensions are rejected before the picker opens.
    • If the user cancels, the call still succeeds: file is null for FilePicker.pickFile and files is empty for FilePicker.pickFiles.
    • Picked files are stored in the app cache. They are deleted when the local server starts or closes, so save a file with FileSaver.saveUrl if you need to keep it.
    import { FilePicker } from '@yandeu/js-bridge/lib/plugins/filePicker.js'

    const res = await FilePicker.pickFile({ allowedExtensions: ['pdf'] })
    if (res.ok && res.payload.file) link.href = res.payload.file.url