forked from mdn/content
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
85 lines (62 loc) · 3.36 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
---
title: LocalFileSystemSync.requestFileSystemSync()
slug: Web/API/LocalFileSystemSync/requestFileSystemSync
browser-compat: api.LocalFileSystemSync.requestFileSystemSync
---
<p>{{APIRef("File System API")}}{{SeeCompatTable}}{{deprecated_header}}{{Draft}}</p>
<p>The <strong><code>requestFileSystemSync</code></strong> method of the <code>LocalFileSystemSync</code> interface of the <a href="/en-US/docs/Web/API/File_and_Directory_Entries_API/Introduction">File System API</a> creates a new a sandboxed file system. It is intended to be used with <a href="/en-US/docs/Web/API/Worker"> WebWorkers</a>. The methods are implemented by <a href="/en-US/docs/Web/API/Worker">worker</a> objects.</p>
<div class="notecard warning">
<p><strong>Warning:</strong> This document was last updated on March 2, 2012 and follows the <a href="https://www.w3.org/TR/file-system-api/">W3C Specifications (Working Draft)</a> drafted on April 19, 2011.</p>
<p>This specification is more or less abandoned, failing to get significant traction.</p>
</div>
<h2 id="requestFileSystem">Syntax</h2>
<pre><em>LocalFileSystemSync</em>.requestFileSystemSync(
unsigned short type,
unsigned long long size
);</pre>
<h3 id="Parameters">Parameters</h3>
<dl>
<dt><code>type</code></dt>
<dd>The storage type of the file system. The values can be either <code>TEMPORARY</code> or <code>PERSISTENT</code>.</dd>
<dt><code>size</code></dt>
<dd>The storage space — in bytes — that you need for your app.</dd>
</dl>
<h3 id="Returns">Returns</h3>
<dl>
<dt>{{domxref("FileSystemSync")}}</dt>
<dd>An object that represents the file system.</dd>
</dl>
<h2 id="Exceptions">Exceptions</h2>
<p>This method can raise an <a href="/en-US/docs/Web/API/FileException">FileException</a> with the following code:</p>
<table class="standard-table">
<thead>
<tr>
<th scope="col">Exception</th>
<th scope="col">Description</th>
</tr>
<tr>
<td><code>SECURITY_ERROR</code></td>
<td>The application does not have permission to access the file system interface. For example, you cannot run from <code>file://</code>. For more details, see the <a href="/en-US/docs/Web/API/File_and_Directory_Entries_API/Introduction#you_cannot_run_your_app_from_file:.2f.2f">article on basic concepts</a>.</td>
</tr>
</thead>
</table>
<h2 id="Examples">Examples</h2>
<pre class="brush: js">//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*/);</pre>
<p>Since this interface is synchronous, it doesn't need success and error callbacks.</p>
<h2 id="Specifications">Specifications</h2>
{{Specifications}}
<h2 id="Browser_compatibility">Browser compatibility</h2>
<p>{{Compat}}</p>
<h2 id="See_also">See also</h2>
<ul>
<li>{{domxref("LocalFileSystem.requestFileSystem")}}, asynchronous equivalent of this interface</li>
<li><a href="/en-US/docs/Web/API/File_and_Directory_Entries_API/Introduction">File System API</a></li>
<li><a href="/en-US/docs/Web/API/File_and_Directory_Entries_API/Introduction">Basic Concepts About the File System API</a></li>
</ul>