ionic-team / ionic-team/capacitor-file-transfer

Filesystem.downloadFile fails for unknown reason

Open
#25 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11
Forks
10
PR merge metrics
No merged PRs in 30d

Description

## Bug Report

### Plugin(s)
"@capacitor/filesystem": "^6.0.1",

### Capacitor Version
```
npx cap doctor
Capacitor Doctor

Latest Dependencies:

@capacitor/cli: 6.1.2
@capacitor/core: 6.1.2
@capacitor/android: 6.1.2
@capacitor/ios: 6.1.2

Installed Dependencies:

@capacitor/ios: not installed
@capacitor/cli: 6.0.0
@capacitor/android: 6.0.0
@capacitor/core: 6.0.0

[success] Android looking great! 👌
```

### Platform(s)
Android

### Current Behavior
I've got the following code in place to download a file:

```
Filesystem.downloadFile({
method: 'POST',
data: payload,
url: this.dataService.downloadFileAttachment(),
headers: headers,
directory: Directory.Documents,
path: "test.bin",
progress: true
})
.then((result) => {
console.info("result:", result)
})
.catch((e) => {
console.error("error:", e)
})
```

The code runs, doesn't appear to download anything and fails pretty much instantly, I get the following error on the console:

```
VM3:339 result Filesystem.downloadFile (#70225240)
8054.da0d23dc07e24a1c.js:1 error: ke: Error downloading file: http://endpoint.com/download
at returnResult (:943:32)
at win.androidBridge.onmessage (:918:21)
```

### Expected Behavior
File should be downloaded

### Code Reproduction
See above

### Other Technical Details

### Additional Context

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.