private function open(string $folder, string $file): File
    {
        $path = $folder.'/'.$file;

        if (is_dir($path)) {
            $object = new Directory\Directory(
                $file,
                (function($folder) {
                    $handle = opendir($folder);

                    while (($name = readdir($handle)) !== false) {
                        if (\in_array($name, self::INVALID_FILES, true)) {
                            continue;
                        }

                        yield $this->open($folder, $name);
                    }

                    closedir($handle);
                })($path)
            );
        } else {
            try {
                $mediaType = MediaType::fromString(mime_content_type($path));
            } catch (InvalidMediaTypeString $e) {
                $mediaType = new NullMediaType;
            }

            $object = new File\File(
                $file,
                new LazyStream($path),
                $mediaType
            );
        }

        $this->files = $this->files->put($path, $object);

        return $object;
    }