According to doc, Filesystem.downloadFile()
is used to
Perform a http request to a server and download the file to the specified destination.
But the DownloadFileOptions
only includes path
, directory
, progress
, recursive
.
There is no parameter for an URL. So how can this be used?
DownloadFileOptions
extends HttpOptions
, so it has all the properties HttpOptions
have plus the specific ones from DownloadFileOptions
.
But there is a problem with the docs generator that don’t show the properties from the extended object.
You can check HttpOptions
properties here Http Capacitor Plugin API | Capacitor Documentation
@julio-ionic Awesome, thanks for your info! Created an issue about it.
Just testing it out. This works:
import { CapacitorHttp } from '@capacitor/core';
let url = 'http://192.168.178.25:3000/'
const response = await CapacitorHttp.request({method: 'GET', url })
console.log('response', response)
But this does not, it just stops, no “dl” output:
import { Filesystem } from '@capacitor/filesystem'
let url = 'http://192.168.178.25:3000/'
console.log('url', url)
const dl = await FileSystem.downloadFile({
method: 'GET',
url,
directory: Directory.Data,
path: '123.txt'
})
console.log('dl', dl)
Update: Bad misspelling FileSystem
and my editor didn’t tell me.
@julio-ionic hello bro did you try for example downloading using the FileSystem.downloadFile and call other plugin for example you navigate to other page of you app that uses other capacitor plugin while in the progress of downloading or the download is not finish yet like large file.
my issue it stop the other plugin to be called when the download is not finish yet and execute when finish