Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70991

File.writefile blob from API rest service

$
0
0

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!

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 70991

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>