账号密码登录
微信安全登录
微信扫描二维码登录

登录后绑定QQ、微信即可实现信息互通

手机验证码登录
找回密码返回
邮箱找回 手机找回
注册账号返回
其他登录方式
分享
  • 收藏
    X
    window.requestFileSystem(type, size, successCallback);
    • 维姐,不接语音请打字2020-01-01 00:00
    28
    0

    有人知道上面这个请求访问沙盒函数中的size的大小限制吗?我的需求是想实现一个web版的文件管理系统,主要功能是实现大文件的切割上传以及断点续传功能。下载过程的断点续传的思想是,下载某个文件前,先读取本地的缓存文件夹,判断是否已有该文件,若已有该文件则获取该文件的内容,然后仅需要将该文件没有的部分内容下载并写入到该文件即可,主要采用了file.slice()函数。因为JS无法操控本地文件,但FileSystem API有沙盒文件可提供给用户操作,所以我的思想就是将沙盒做为那个文件目录,每次请求文件前请求该沙盒,判断该沙盒中是否有要下载的文件(因为沙盒中有FileReader和Filewriter可以用来操作文件实现断点续传,其实此处并没有将文件下载到用户的操作系统目录),现在的问题是不知道请求沙盒分配空间时(即调用window.requestFileSystem(type, size, successCallback[, errorCallback]);),其中的size有没有大小限制,大概是多少,因为我这个系统主要是用来处理大文件的,不知道沙盒有没有大小限制。
    FileSystem中沙盒的操作可见https://github.com/guangying1...

    0
    打赏
    收藏
    点击回答
        全部回答
    • 0
    • 其实喜欢你 普通会员 1楼

      requestFileSystem is a method of the window object that allows you to access and manipulate the file system on your device. It takes three arguments:

      • type: specifies the type of file system you want to access. In this case, type is set to 'read-only' which means that only read access is allowed to the file system.
      • size: specifies the size of the file system in bytes. This argument is optional.
      • successCallback: is a function that is called when the request is successful. The function takes one argument, which is a promise that will resolve to the result of the request. In this case, the successCallback function should return a promise that resolves to the result of the request.

      Here is an example of how you might use requestFileSystem: javascript requestFileSystem('read-only', 1000000, function(error, fileSystem) { if (error) { console.error(error); } else { console.log(fileSystem.root); } });

      In this example, we're requesting a file system with type 'read-only', a size of 1000000 bytes, and a callback function that will be called when the request is successful. If there is an error, we'll log it to the console. If the request is successful, we'll log the root directory of the file system to the console.

    更多回答
    扫一扫访问手机版
    • 回到顶部
    • 回到顶部