API:DirectoryStream::next

From Spherical
Revision as of 16:32, 17 August 2017 by Bruce Pascoe (talk | contribs) (Note that return value is iterator-like)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search


The DirectoryStream::next() method reads the next directory entry from a directory stream.

Usage
dir_entry = dirstream_obj.next();

API Information

Description

DirectoryStream::next() reads the next directory entry from the stream and advances the stream position. The value of DirectoryStream::position determines which entry is read.

Parameters

This method has no parameters.

Return Value

An object with two properties, .done and .value, with semantics compatible with the ES2015 iterator protocol. If there are no more entries to retrieve, .done is true and .value is undefined. Otherwise, .done is false and .value is an object describing the directory entry:

Property Type Description
.fileName string The name of the file or directory, e.g. pig.js. If the entry is a directory, .fileName will end in a slash (/).
.fullPath string The full SphereFS pathname of the file or directory, e.g. @/scripts/pig.js.
.isDirectory boolean true if the entry is a directory, otherwise false.

See Also