import RNBackgroundDownloader from 'react-native-background-downloader';
let task = RNBackgroundDownloader.download({
id: 'file123',
url: 'https://link-to-very.large/file.zip'
destination: `${RNBackgroundDownloader.directories.documents}/file.zip`
}).begin((expectedBytes) => {
console.log(`Going to download ${expectedBytes} bytes!`);
}).progress((percent) => {
console.log(`Downloaded: ${percent * 100}%`);
}).done(() => {
console.log('Download is done!');
}).error((error) => {
console.log('Download canceled due to error: ', error);
});
// Pause the task
task.pause();
// Resume after pause
task.resume();
// Cancel the task
task.stop();我正在使用上面的代码。在这个问题中,它下载了一个文件并按原样保存。但是我想编码一个文件,然后将它直接保存在android文件夹的内部。如果有人有主意就告诉我。这样我就可以在文件保存后进行编码。
谢谢
发布于 2022-01-05 12:55:32
不如先下载文件,然后对本地文件进行编码,然后保存已编码的文件并删除原始文件。
https://stackoverflow.com/questions/70593035
复制相似问题