@param string $path

@return resource

@throws OneDriveClientException

@link https://dev.onedrive.com/items/download.htm
169643
public function downloadStream($path)
    {
        $url = $this->getDownloadUrlForFile($path);
        $input = $this->getStreamForUrl($url);

        $output = fopen('php://temp', 'w+');
        if ($output === false) {
            throw new OneDriveClientException('Error when saving the downloaded file');
        }

        while (!$input->eof()) {
            $writeResult = fwrite($output, $input->read(8192));
            if ($writeResult === false) {
                throw new OneDriveClientException('Error when saving the downloaded file');
            }
        }

        $input->close();

        rewind($output);

        return $output;
    }
1196563
public function getUrl( $path )
    {
        if (!$this->has($path)) throw new FileNotFoundException($filePath.' not found');
        return ( $this->ssl ? 'https://' : 'http://' ) . ( $this->isCname ? ( $this->cdnDomain == '' ? $this->endPoint : $this->cdnDomain ) : $this->bucket . '.' . $this->endPoint ) . '/' . ltrim($path, '/');
    }
227018
public function read( $path )
	{
		try {
			return $this->fs->get( $path );
		} catch( \Exception $e ) {
			throw new Exception( $e->getMessage(), 0, $e );
		}
	}
724699
public static function fromUnReadableFile($path)
    {
        if (! file_exists($path)) {
            return new self(sprintf('Invalid path provided, the path "%s" does not seem to exist', $path));
        }

        if (is_dir($path)) {
            return new self(sprintf('The provided path "%s" is a directory, and it cannot be read as a file', $path));
        }

        return new self(sprintf('The provided path "%s" is invalid', $path));
    }
159362
public function path($path)
    {
        $path = trim($path);

        if (str_empty($this->fileName)) {
            $this->fileName(basename($path));
        }

        if (str_empty($this->fileType)) {
            $this->fileType(mime_content_type($path));
        }

        $this->fileContent(fopen($path, 'r'));

        return $this;
    }
1025810
public function downloadAction(string $path): Response
    {
        if (!$meta = $this->filesystem->getMetadata($path)) {
            throw new NotFoundHttpException('Media not found: ' . $path);
        }

        $content = $this->filesystem->read($path);

        $response = new Response($content);
        $response->headers->set('Content-Type', $meta['mimetype']);
        $response->headers->set('Content-Length', $meta['size']);
        $response->headers->set('Content-Transfer-Encoding', 'binary');

        $name = explode('/', $path);

        $disposition = $response->headers->makeDisposition(ResponseHeaderBag::DISPOSITION_ATTACHMENT, $name[count($name) - 1]);
        $response->headers->set('Content-Disposition', $disposition);

        return $response;
    }
636541
public function fromPath($path)
    {
        $schemeClass = $this->schemeClass('file');
        if ($this->isolator->defined('PHP_WINDOWS_VERSION_BUILD')) {
            $uri = $schemeClass::fromWindowsPath($path);
        } else {
            $uri = $schemeClass::fromUnixPath($path);
        }

        return $uri;
    }
1317104
public function resource($path = null)
    {
        if (!empty($path)) {
            $this->resourcePath = $path;

            return $this;
        }

        if (!empty($this->resourcePath)) {
            return $this->resourcePath;
        }

        return app('request')->getPathInfo();
    }
85671
public static function create(string $path): self
    {
        if (!is_dir($path)) {
            if (is_writeable(dirname($path))) {
                if (mkdir($path)) {
                    return new static($path);
                }
                throw new FolderException('Creating folder ('.$path.') failed');
            }
            throw new FolderException('Cannot create folder, because the directory ('.dirname($path).') is not accessible',
                FolderException::NOT_WRITEABLE);
        }
        throw new FolderException('Cannot create folder, because the folder path ('.$path.') already exists', FolderException::ALREADY_EXIST);
    }
1039945
public function file($path)
    {
        return $this->files(dirname($path))->first(function ($file) use ($path) {
            return $file['path'] === $path;
        }, function () use ($path) {
            throw new FileNotFoundException("File [$path] not found!");
        });
    }
1356912
public function path($path) {
		$path = explode('/', $path);
		for ($i = 0; $i < count($path); $i++) {
			$path[$i] = urlencode($path[$i]);
		}

		$this->path = implode('/', $path);
		return $this;
	}
526587
public function loadIniFile($path)
    {

        $this->iniSettings = (array)parse_ini_string(
            $this->pool->fileService->getFileContents($path, false),
            true
        );

        return $this;
    }
802519
public function initFromPath($path)
    {
        if ( ! file_exists($path)) {
            throw new \Hail\Image\Exception\NotReadableException(
                "Unable to find file ({$path})."
            );
        }

        // get mime type of file
        $mime = MimeType::getMimeTypeByFile($path);

        // define core
        switch (strtolower($mime)) {
            case 'image/png':
            case 'image/x-png':
                $core = @imagecreatefrompng($path);
                break;

            case 'image/jpg':
            case 'image/jpeg':
            case 'image/pjpeg':
                $core = @imagecreatefromjpeg($path);
                if (!$core) {
                    $core= @imagecreatefromstring(file_get_contents($path));
                }
                break;

            case 'image/gif':
                $core = @imagecreatefromgif($path);
                break;

            case 'image/webp':
            case 'image/x-webp':
                if ( ! function_exists('imagecreatefromwebp')) {
                    throw new \Hail\Image\Exception\NotReadableException(
                        "Unsupported image type. GD/PHP installation does not support WebP format."
                    );
                }
                $core = @imagecreatefromwebp($path);
                break;

            default:
                throw new \Hail\Image\Exception\NotReadableException(
                    "Unsupported image type. GD driver is only able to decode JPG, PNG, GIF or WebP files."
                );
        }

        if (empty($core)) {
            throw new \Hail\Image\Exception\NotReadableException(
                "Unable to decode image from file ({$path})."
            );
        }

        $this->gdResourceToTruecolor($core);

        // build image
        $image = $this->initFromGdResource($core);
        $image->mime = $mime;
        $image->setFileInfoFromPath($path);

        return $image;
    }
1347964
public static function decodeFromFile($path)
    {
        if (!file_exists($path)) {
            throw new \RuntimeException("File $path does not exist");
        }

        $buffer = file_get_contents($path);
        $object = self::decode($buffer);

        return $object;
    }
588043
public function loadFile($path) {
        $config = null;

        try {
            $config = require $path;
        } catch (Exception $ex) {}

        if ( ! is_array($config)) {
            throw new InvalidConfigFormatException(
                s('ArrayConfigDriver expects config at path %s to be of format array[key => value].', $path)
            );
        }

        return $config;
    }
595783
protected function getLocalUrl($path)
    {
        $prop = $this->property();
        if ($prop instanceof FileProperty) {
            if ($prop->publicAccess() === false) {
                $query = http_build_query([
                    'disk' => $prop->filesystem(),
                    'path' => $path,
                ]);
                return $this->adminUrl('filesystem/download')->withQuery($query);
            }
        }

        return $this->baseUrl($path);
    }
1202564
public function getFile($path) {
		$dirPath = realpath($this->path);
		
		if ($dirPath === false) {
			throw new InvalidPath('Path "' . $this->path . '" doesn\'t exists or inaccsessible', null, null, $this->path);
		}
		
		return new File($dirPath . DIRECTORY_SEPARATOR . $path);
	}