public function downloadFromDir(
        LibraryType $library,
        DirectoryItem $item,
        string $localFilePath,
        string $dir,
        int $reuse = 1
    ): Response {
        if (is_readable($localFilePath)) {
            throw new Exception('File already exists');
        }

        $downloadUrl = $this->getDownloadUrl($library, $item, $dir, $reuse);

        return $this->client->request('GET', $downloadUrl, ['save_to' => $localFilePath]);
    }
public function downloadFromDir(
        LibraryType $library,
        DirectoryItem $item,
        string $localFilePath,
        string $dir,
        int $reuse = 1
    ): Response {
        if (is_readable($localFilePath)) {
            throw new Exception('File already exists');
        }

        $downloadUrl = $this->getDownloadUrl($library, $item, $dir, $reuse);

        return $this->client->request('GET', $downloadUrl, ['save_to' => $localFilePath]);
    }
public function downloadFromDir ( LibraryType $ library , DirectoryItem $ item , string $ localFilePath , string $ dir , int $ reuse = 1 ) : Response { if ( is_readable ( $ localFilePath ) ) { throw new Exception ( 'File already exists' ) ; } $ downloadUrl = $ this -> getDownloadUrl ( $ library , $ item , $ dir , $ reuse ) ; return $ this -> client -> request ( 'GET' , $ downloadUrl , [ 'save_to' => $ localFilePath ] ) ; }
Get download URL of a file from a Directory item

@param LibraryType   $library       Library instance
@param DirectoryItem $item          Item instance
@param string        $localFilePath Save file to path
@param string        $dir           Dir string
@param int           $reuse         Reuse more than once per hour

@return Response
@throws Exception
@throws \GuzzleHttp\Exception\GuzzleException
Get download URL of a file from a Directory item