Difference between revisions of "API:DirectoryStream::next"
(Add page for DirectoryStream::next())
Revision as of 18:31, 15 August 2017
The DirectoryStream::next() method reads the next directory entry from a directory stream.
dir_entry = dirstream_obj.next();
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.
This method has no parameters.
An object with two properties, .done and .value. 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.