Skip to content

Downloading files on web to the filesystem saves it as base64 instead of a native blob #71

Description

@dh-linetco

Bug Report

Capacitor Version

@capacitor/cli: 7.4.0
@capacitor/android: 7.4.0
@capacitor/ios: 7.4.0
@capacitor/core: 7.4.0
@capacitor/file-transfer: 1.0.12
@capacitor/filesystem: 7.1.8

Platform(s)

Web

Current Behavior

We switched to this plugin to avoid the overhead of converting binary files to base64. This works for android and ios but downloading a file on the web using downloadFile downloads it as a blob but then converts it to base64 when trying to write it to the indexed db. The indexed db supports blob natively so this only increases the file size and each time we want to read the file we need to convert it back from base64 which is bad for big files.

Expected Behavior

Just save the received blob directly to the indexed db.

Code Reproduction

Other Technical Details

see https://github.com/ionic-team/capacitor-file-transfer/blob/main/packages/capacitor-plugin/src/web.ts#L465

Additional Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions