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
|
---
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>
|