FileSystemDirectoryReader.readEntries()

Experimental: 这是一个实验中的功能
此功能某些浏览器尚在开发中,请参考浏览器兼容性表格以得到在不同浏览器中适合使用的前缀。由于该功能对应的标准文档可能被重新修订,所以在未来版本的浏览器中该功能的语法和行为可能随之改变。

非标准: 该特性是非标准的,请尽量不要在生产环境中使用它!

The FileSystemDirectoryReader interface's readEntries() method retrieves the directory entries within the directory being read and delivers them in an array to a provided callback function. The objects in the array are all based upon FileSystemEntry. Generally, they are either FileSystemFileEntry objects, which represent standard files, or FileSystemDirectoryEntry objects, which represent directories.

Syntax

readEntries(successCallback[, errorCallback]);

Parameters

successCallback
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 FileSystemEntry. Generally, they are either FileSystemFileEntry objects, which represent standard files, or FileSystemDirectoryEntry objects, which represent directories. If there are no files left, or you've already called readEntries() on this FileSystemDirectoryReader, the array is empty.
errorCallback 可选
A callback function which is called if an error occurs while reading from the directory. It receives one input parameter: a FileError object describing the error which occurred.

Return value

Example

{{page("/en-US/docs/Web/API/DataTransferItem/webkitGetAsEntry", "Example")}}

Specifications

Specification Status Comment
File and Directory Entries API Draft Draft of proposed API

This API has no official W3C or WHATWG specification.

Browser compatibility

BCD tables only load in the browser

See also