Folder::stream()

Streams the contents of the folder.

Table of Contents
  1. Description
  2. Example

Description

Folder::stream(?int|string $x = null, int|true $deep = 0): Traversable;

This method streams the contents of the folder.

Example

$folder = new Folder('.\path\to\folder');

foreach ($folder->stream() as $k => $v) {
    echo $k . '<br>'; // `$k` returns the captured file/folder path from the stream
    echo $v->name() . '<br>'; // `$v` can be an instance of `File` or `Folder` class
}

The $deep and $x options are actually options for function g() and they have the exact same rules and usages.

Folder::size()

Gets the total sizes of files contained in the folder in human readable string format.

Folder::stream()

Streams the contents of the folder.