Hi, we have this API rest service that returns a generic file (may be a pdf, an image and so on) as ‘data’.
We import ‘file’ from ‘@ionic-native/File/ngx’;
getFileFromService().subscribe(async data => {
try {
const fileName = ‘downloadedFile’;
const blob = new Blob([data], { type: ‘application/octet-stream’ });
this.file.writeFile(this.file.externalRootDirectory + ‘Download’, fileName, blob, {replace: true, append: false});
} catch (err) {
…
}
}, error => {
…
});
On Android device if the file is small no problem, but if the file is big the downloaded file size is always 1024 KB.
Some idea?
Thank you!