What are the details can be obtained from webkitStorageInfo.queryUsageAndQuota()

后端 未结 3 1734
悲哀的现实
悲哀的现实 2021-01-20 19:28

webkitStorageInfo.queryUsageAndQuota() is used to find out the usage stats of the files that have been stored in the file system using the HTML5 file system API I suppose. C

3条回答
  •  情话喂你
    2021-01-20 19:48

    Replace function(){...} with console.log.bind(console), and you will find out.

    > window.webkitStorageInfo.queryUsageAndQuota(webkitStorageInfo.PERSISTENT, console.log.bind(console))
    undefined  // Return value of ^
    0 0        // Printed results, argument 0 and argument 1
    

    The explanation of the callback is found here:

    interface StorageInfo { 
      ....
      // Queries the current quota and how much data is stored for the host. 
      void queryUsageAndQuota( 
          unsigned short storageType, 
          optional StorageInfoUsageCallback successCallback, 
          optional StorageInfoErrorCallback errorCallback); 
      ...
    
    [NoInterfaceObject, Callback=FunctionOnly] 
    interface StorageInfoUsageCallback { 
      void handleEvent(unsigned long long currentUsageInBytes, 
                       unsigned long long currentQuotaInBytes); 
    };

    So, the first number indicates how many bytes are used,
    the second number shows the quota's size.

提交回复
热议问题