LocalFileSystemSync.requestFileSystemSync() - Web APIs 编辑
Experimental
This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Deprecated
This feature is no longer recommended. Though some browsers might still support it, it may have already been removed from the relevant web standards, may be in the process of being dropped, or may only be kept for compatibility purposes. Avoid using it, and update existing code if possible; see the compatibility table at the bottom of this page to guide your decision. Be aware that this feature may cease to work at any time.
Draft
This page is not complete.
The requestFileSystemSync
method of the LocalFileSystemSync
interface of the File System API creates a new a sandboxed file system. It is intended to be used with WebWorkers. The methods are implemented by worker objects.
Warning:
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.
Syntax
LocalFileSystemSync.requestFileSystemSync( unsigned short type, unsigned long long size );
Parameters
type
- The storage type of the file system. The values can be either
TEMPORARY
orPERSISTENT
. size
- The storage space — in bytes — that you need for your app.
Returns
FileSystemSync
- An object that represents the file system.
Exceptions
This method can raise an FileException with the following code:
Exception | Description |
---|---|
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. |
Examples
//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*/);
Since this interface is synchronous, it doesn't need success and error callbacks.
Specifications
Specification | Status | Comment |
---|---|---|
File API: Directories and System Specification | Working Draft | Initial specification, abandoned. |
See also
LocalFileSystem.requestFileSystem
, asyncronous equivalent of this interface- File System API
- Basic Concepts About the File System API
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论