Difference between revisions of "API:DirectoryStream"
From Spherical
Bruce Pascoe (talk | contribs) (Create DirectoryStream constructor page) |
Bruce Pascoe (talk | contribs) (Add DirectoryStream::dispose()) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 18: | Line 18: | ||
<tr> | <tr> | ||
<td>''Note:''</td> | <td>''Note:''</td> | ||
− | <td><tt>DirectoryStream</tt> | + | <td>The <tt>DirectoryStream</tt> class implements the JavaScript ''iterator protocol'', which means you can use them in <tt>[[API:from|from()]]</tt> queries and <tt>for-of</tt> loops.</td> |
</tr> | </tr> | ||
</table> | </table> | ||
Line 30: | Line 30: | ||
</tr> | </tr> | ||
</table> | </table> | ||
+ | |||
+ | === Return Value === | ||
+ | |||
+ | A newly constructed <tt>DirectoryStream</tt> object pointing at <tt>''dir_name''</tt>. | ||
+ | |||
+ | == Class Information == | ||
=== Properties === | === Properties === | ||
Line 42: | Line 48: | ||
<tt> | <tt> | ||
+ | * [[API:DirectoryStream::dispose|DirectoryStream::dispose()]] | ||
* [[API:DirectoryStream::next|DirectoryStream::next()]] | * [[API:DirectoryStream::next|DirectoryStream::next()]] | ||
* [[API:DirectoryStream::rewind|DirectoryStream::rewind()]] | * [[API:DirectoryStream::rewind|DirectoryStream::rewind()]] | ||
+ | </tt> | ||
+ | |||
+ | == See Also == | ||
+ | |||
+ | <tt> | ||
+ | * [[API:from|from()]] | ||
+ | * [[API:FileStream|new FileStream()]] | ||
</tt> | </tt> | ||
[[Category:Sphere 2 API]] | [[Category:Sphere 2 API]] |
Latest revision as of 03:26, 14 August 2017
The new DirectoryStream() constructor initializes an object that allows you to enumerate the contents of a directory.
Usage
dirstream_obj = new DirectoryStream(dir_name);
Contents
API Information
Description
new DirectoryStream() constructs a Directory Stream object, which allows you to enumerate the contents of a directory. Directory streams only provide filenames; you must use a FileStream to access the contents of a file.
Note: | The DirectoryStream class implements the JavaScript iterator protocol, which means you can use them in from() queries and for-of loops. |
Parameters
dir_name | Path to the directory to be enumerated. Relative to the game manifest unless a SphereFS prefix is included. |
Return Value
A newly constructed DirectoryStream object pointing at dir_name.
Class Information
Properties
Methods
See Also