diff options
| author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
|---|---|---|
| committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
| commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
| tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/filesystemdirectoryreader | |
| parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
| download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip | |
initial commit
Diffstat (limited to 'files/zh-cn/web/api/filesystemdirectoryreader')
| -rw-r--r-- | files/zh-cn/web/api/filesystemdirectoryreader/index.html | 67 | ||||
| -rw-r--r-- | files/zh-cn/web/api/filesystemdirectoryreader/readentries/index.html | 68 |
2 files changed, 135 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/filesystemdirectoryreader/index.html b/files/zh-cn/web/api/filesystemdirectoryreader/index.html new file mode 100644 index 0000000000..471b5a4240 --- /dev/null +++ b/files/zh-cn/web/api/filesystemdirectoryreader/index.html @@ -0,0 +1,67 @@ +--- +title: FileSystemDirectoryReader +slug: Web/API/FileSystemDirectoryReader +tags: + - API + - File System API + - File and Directory Entries API + - FileSystemDirectoryReader + - Files + - Interface + - NeedsTranslation + - Non-standard + - Offline + - Reference + - TopicStub +translation_of: Web/API/FileSystemDirectoryReader +--- +<p>{{APIRef("File System API")}}{{Non-standard_header}}</p> + +<p>The <code>FileSystemDirectoryReader</code> interface of the <a href="/en-US/docs/Web/API/File_and_Directory_Entries_API">File and Directory Entries API</a> lets you access the {{domxref("FileEntry")}}-based objects (generally {{domxref("FileSystemFileEntry")}} or {{domxref("FileSystemDirectoryEntry")}}) representing each entry in a directory.</p> + +<div class="note"> +<p>Because this is a non-standard API, whose specification is not currently on a standards track, it's important to keep in mind that not all browsers implement it, and those that do may implement only small portions of it. Check the {{anch("Browser compatibility")}} section for details.</p> +</div> + +<h2 id="Methods">Methods</h2> + +<dl> + <dt>{{domxref("FileSystemDirectoryReader.readEntries", "readEntries()")}}</dt> + <dd>Returns a an array containing some number of the directory's entries. Each item in the array is an object based on {{domxref("FileSystemEntry")}}—typically either {{domxref("FileSystemFileEntry")}} or {{domxref("FileSystemDirectoryEntry")}}.</dd> +</dl> + +<h2 id="Specifications">Specifications</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('File System API')}}</td> + <td>{{Spec2('File System API')}}</td> + <td>Draft of proposed API</td> + </tr> + </tbody> +</table> + +<p>This API has no official W3C or WHATWG specification.</p> + +<h2 id="Browser_compatibility" name="Browser_compatibility">Browser compatibility</h2> + + + +<p>{{Compat("api.FileSystemDirectoryReader")}}</p> + +<h2 id="See_also">See also</h2> + +<ul> + <li><a href="/en-US/docs/Web/API/File_and_Directory_Entries_API">File and Directory Entries API</a></li> + <li><a href="/en-US/docs/Web/API/File_and_Directory_Entries_API/Introduction">Introduction to the File System API</a></li> + <li>{{domxref("FileSystemDirectoryEntry")}}</li> + <li>{{domxref("FileSystem")}}</li> +</ul> diff --git a/files/zh-cn/web/api/filesystemdirectoryreader/readentries/index.html b/files/zh-cn/web/api/filesystemdirectoryreader/readentries/index.html new file mode 100644 index 0000000000..c1a8611a3d --- /dev/null +++ b/files/zh-cn/web/api/filesystemdirectoryreader/readentries/index.html @@ -0,0 +1,68 @@ +--- +title: FileSystemDirectoryReader.readEntries() +slug: Web/API/FileSystemDirectoryReader/readEntries +translation_of: Web/API/FileSystemDirectoryReader/readEntries +--- +<div>{{APIRef("File System API")}}</div> + +<p>{{SeeCompatTable}}{{Non-standard_header}}</p> + +<p><span class="seoSummary">The {{domxref("FileSystemDirectoryReader")}} interface's <strong><code>readEntries()</code></strong> method retrieves the directory entries within the directory being read and delivers them in an array to a provided callback function.</span> The objects in the array are all based upon {{domxref("FileSystemEntry")}}. Generally, they are either {{domxref("FileSystemFileEntry")}} objects, which represent standard files, or {{domxref("FileSystemDirectoryEntry")}} objects, which represent directories.</p> + +<h2 id="Syntax">Syntax</h2> + +<pre class="syntaxbox">readEntries(<em>successCallback</em>[, <em>errorCallback</em>]); +</pre> + +<h3 id="Parameters">Parameters</h3> + +<dl> + <dt><code>successCallback</code></dt> + <dd>A function which is called when the directory's contents have been retrieved. The function receives a single input parameter: an array of file system entry objects, each based on {{domxref("FileSystemEntry")}}. Generally, they are either {{domxref("FileSystemFileEntry")}} objects, which represent standard files, or {{domxref("FileSystemDirectoryEntry")}} objects, which represent directories. If there are no files left, or you've already called <code>readEntries()</code> on this {{domxref("FileSystemDirectoryReader")}}, the array is empty.</dd> + <dt><code>errorCallback</code> {{optional_inline}}</dt> + <dd>A callback function which is called if an error occurs while reading from the directory. It receives one input parameter: a {{domxref("FileError")}} object describing the error which occurred.</dd> +</dl> + +<h3 id="Return_value">Return value</h3> + +<p>{{jsxref("undefined")}}.</p> + +<h2 id="Example">Example</h2> + +<p>{{page("/en-US/docs/Web/API/DataTransferItem/webkitGetAsEntry", "Example")}}</p> + +<h2 id="Specifications">Specifications</h2> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('File System API')}}</td> + <td>{{Spec2('File System API')}}</td> + <td>Draft of proposed API</td> + </tr> + </tbody> +</table> + +<p>This API has no official W3C or WHATWG specification.</p> + +<h2 id="Browser_compatibility" name="Browser_compatibility">Browser compatibility</h2> + + + +<p>{{Compat("api.FileSystemDirectoryReader.readEntries")}}</p> + +<h2 id="See_also">See also</h2> + +<ul> + <li><a href="/en-US/docs/Web/API/File_and_Directory_Entries_API">File and Directory Entries API</a></li> + <li><a href="/en-US/docs/Web/API/File_and_Directory_Entries_API/Introduction">Introduction to the File System API</a></li> + <li>{{domxref("FileSystemDirectoryEntry")}}</li> + <li>{{domxref("FileSystem")}}</li> +</ul> |
