Browse Source

下载文件前,先创建文件夹(修正部分安卓机不自动创建文件夹的问题)

main
郑州 3 years ago
parent
commit
817817dc27
1 changed files with 2 additions and 0 deletions
  1. +2
    -0
      src/utils/autoGCFileSystem.js

+ 2
- 0
src/utils/autoGCFileSystem.js View File

@@ -6,6 +6,7 @@ const singleFileMaxSize = 50 * 1024 * 1024;
const maxSpaceSize = 200 * 1024 * 1024;
const dir = wx.env.USER_DATA_PATH;
const genFilePath = (ipfsCid, extension, fileName) => `${dir}/${ipfsCid}/${fileName}.${extension}`;
const genFileFolder = ipfsCid => `${dir}/${ipfsCid}`;
const fileManager = getFileSystemManager();
const isAndroid = wx.getSystemInfoSync().platform === 'android';
const iosSupportFilesType = ['doc', 'docx', 'xls', 'xlsx', 'ppt', 'pptx', 'pdf'];
@@ -65,6 +66,7 @@ export function previewFile(ipfsCid, fileName, extension, fileSize) {
fail: () => {
gcDirSpace();
showLoading({ mask: true });
fileManager.mkdirSync(genFileFolder(ipfsCid));
const task = downloadFile(ipfsCid, {
filePath,
success: (param) => {


Loading…
Cancel
Save