非标
此特征是非标准的,且不在标准轨道中。不要在面向 Web 的生产站点中使用它:它不适用于每个用户。实现之间可能存在大的不兼容性,且行为将来可能改变。
LocalFileSystemSync
接口在
文件系统 API
gives you access to a sandboxed file system. It is intended to be used with
WebWorkers
. The methods are implemented by
worker
对象。
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
LocalFileSystemSync
object from within a web worker. The global methods in the
window
对象
requestFileSystemSync()
and
resolveLocalFileSystemSyncURL()
methods are exposed to the Worker's global scope. Calling
window.requestFileSystemSync()
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.
FileSystemSync
requestFileSystemSync
(in unsigned short
type
, in long long
size
) raises
FileException
;
|
EntrySync
resolveLocalFileSystemSyncURL
(in DOMString
url
) raises
FileException
;
|
| 常量 | 值 | 描述 |
|---|---|---|
TEMPORARY
|
0
|
Transient storage that can be be removed by the browser at its discretion. |
PERSISTENT
|
1
|
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
LocalFileSystemSync
object from within a web worker using this global method,
window.requestFileSystemSync()
. [ RESEARCH ]
FileSystemSync requestFileSystemSync(
in unsigned short type,
in unsigned long long size
);
TEMPORARY
or
PERSISTENT
.
The storage space—in bytes—that you need for your app.
FileSystemSync
An object that represents the file system.
This method can raise an FileException 通过以下代码:
| 异常 | 描述 |
|---|---|
SECURITY_ERROR
|
The application does not have permission to access the file system interface. For example, you cannot run from
file://
. For more details, see the
article on basic concepts
.
|
Allows the user to look up the
Entry
for a file or directory referred to by a local URL.
void resolveLocalFileSystemURL( in DOMString url );
The URL of a local file in the file system.
EntrySync
An object that represents entries in the file system.
This method can raise a FileException with the following codes:
| 异常 | 描述 |
|---|---|
ENCODING_ERR
|
The syntax of the URL was invalid. |
NOT_FOUND_ERR
|
The URL was structurally correct, but refers to a resource that does not exist. |
SECURITY_ERR
|
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 兼容性数据存储库 .
规范: File API: Directories and System Specification WD
参考: 文件系统 API
介绍: Basic Concepts About the File System API
LocalFileSystemSync
FileError
FileException
FileHandle
FileRequest
FileSystem
FileSystemDirectoryEntry
FileSystemDirectoryEntrySync
FileSystemDirectoryReader
FileSystemDirectoryReaderSync
FileSystemEntry
FileSystemEntrySync
FileSystemFileEntry
FileSystemFileEntrySync
FileSystemFlags
FileSystemSync
HTMLInputElement
LocalFileSystem
LockedFile
元数据
Window.requestFileSystem()
Window.resolveLocalFileSystemURL()
WorkerGlobalScope.requestFileSystemSync()