小编sac*_*hew的帖子

使用Expo.Filesystem.downloadAsync下载大量文件有时会无限期卡死

我正在使用Expo.Filesystem.downloadAsync下载大号。图片和视频之类的文件。但有时有时会无限期地卡住。我打算在循环内下载文件。代码是:

        let image_downloading = section.map(async (item, i) => {
            item.image !== null  ?
                await FileSystem.downloadAsync(item.image,
                    directory + item.image.split("/").reverse()[0]
                )
                    .then(({ uri }) => {
                        item['image'] = uri;
                        console.log('Finished downloading section to ', uri);
                    })
                    .catch(({error}) => {
                        console.log('errorrrrrrrrrrrrr',error)
                    })
                : null
    });
    await Promise.all(image_downloading);
Run Code Online (Sandbox Code Playgroud)

我也尝试过使用FileSystem.createDownloadResumable。使用createDownloadResumable时,下载速度非常慢

android react-native expo

6
推荐指数
1
解决办法
231
查看次数

标签 统计

android ×1

expo ×1

react-native ×1