This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.
This document was last updated on March 2, 2012 and follows the W3C Specifications (Working Draft) drafted on April 19, 2011.
This specification is more or less abandonned, failing to get significant traction.
You can request access to a sandboxed file system by requesting
object from within a web worker. The global methods in the
methods are exposed to the Worker's global scope. Calling
for creates new storage for your web app.
For more concepts, see the counterpart article for the asynchronous API .
//Taking care of the browser-specific prefix window.requestFileSystemSync = window.requestFileSystemSync || window.webkitRequestFileSystemSync; // The first parameter defines the type of storage: persistent or temporary // Next, set the size of space needed (in bytes) // initFs is the success callback // And the last one is the error callback // for denial of access and other errors. var fs = requestFileSystemSync(TEMPORARY, 1024*1024 /*1MB*/);
Because you are using a synchronous API, you don't need success and error callbacks.
Transient storage that can be be removed by the browser at its discretion.
||Storage that stays in the browser unless the user or the app expunges it.|
Requests a file system where data should be stored. You access a sandboxed file system by requesting a
object from within a web worker using this global method,
. [ RESEARCH ]
FileSystemSyncrequestFileSystemSync( in unsigned short type, in unsigned long long size );
This method can raise an FileException with the following code:
The application does not have permission to access the file system interface. For example, you cannot run from
Allows the user to look up the
for a file or directory referred to by a local URL.
void resolveLocalFileSystemURL( in DOMString url );
This method can raise a FileException with the following codes:
||The syntax of the URL was invalid.|
||The URL was structurally correct, but refers to a resource that does not exist.|
||The application does not have permission to access the file system interface.|
No compatibility data found. Please contribute data for "api.LocalFileSystemSync" (depth: 1) to the MDN 兼容性数据存储库 .
Specification: File API: Directories and System Specification WD
Reference: 文件系统 API
Introduction: Basic Concepts About the File System API