Operation getFileAsync

get a file

@param  string $fax_id (required)
@param  string $format can be &#39;pdf&#39; or &#39;tiff&#39; (optional)

@throws \InvalidArgumentException
@return \GuzzleHttp\Promise\PromiseInterface
355834
public function getFileAsync($fax_id, $format = null)
    {
        return $this->getFileAsyncWithHttpInfo($fax_id, $format)
            ->then(
                function ($response) {
                    return $response[0];
                }
            );
    }
15965
public function getFileSetDisplayName($format = 'html')
    {
        $value = tc('FileSetName', $this->getFileSetName());
        switch ($format) {
            case 'html':
                return h($value);
            case 'text':
            default:
            return $value;
        }
    }
1071801
function getPublicKey($format = null)
    {
        return !isset($format) ? $this->key->getPublicKey() : $this->key->getPublicKey($format);
    }
974547
public function downloadAction($id, $format = MediaProviderInterface::FORMAT_REFERENCE)
    {
        $media = $this->getMedia($id);

        if (!$media) {
            throw new NotFoundHttpException(sprintf('unable to find the media with the id : %s', $id));
        }

        if (!$this->get('sonata.media.pool')->getDownloadSecurity($media)->isGranted($media, $this->getCurrentRequest())) {
            throw new AccessDeniedException();
        }

        $response = $this->getProvider($media)->getDownloadResponse($media, $format, $this->get('sonata.media.pool')->getDownloadMode($media));

        if ($response instanceof BinaryFileResponse) {
            $response->prepare($this->getCurrentRequest());
        }

        return $response;
    }
419749
public function getImage(string $format = null) : string
    {
        if (!$format) {
            $format = $this->instance->getImageFormat();
        }
        switch (strtolower($format)) {
            case 'jpg':
            case 'jpeg':
                $this->instance->setImageFormat('jpg');
                break;
            case 'bitmap':
            case 'bmp':
                $this->instance->setImageFormat('bmp');
                break;
            case 'png':
                $this->instance->setImageFormat('png');
                break;
            case 'gif':
                $this->instance->setImageFormat('gif');
                break;
            case 'webp':
                $this->instance->setImageFormat('webp');
                break;
            default:
                throw new ImageException('Unsupported format');
        }
        return $this->instance->getImageBlob();
    }
321101
public static DownloadResponse exportFile(Drive drive, File file, String format) throws IOException {
	  return exportFile(drive, file.getId(), format);
	}
223725
protected function getPath($prePath, $id, $fileName, $format)
    {
        $segment = $this->getSegment($id) . '/';
        $prePath = rtrim($prePath, '/');

        return $prePath . '/' . $format . '/' . $segment . $id . '-' . $fileName;
    }
727951
private function getFile($fileId)
    {
        if (!$fileId) {
            return null;
        }

        $volumeManager = $this->getContainer()->get('phlexible_media_manager.volume_manager');
        $volume = $volumeManager->getByFileId($fileId);
        $file = $volume->findFile($fileId);

        return $file;
    }
1085695
public function getFile(PayoneGetFileTransfer $getFileTransfer)
    {
        $responseContainer = new GetFileResponseContainer();
        $paymentEntity = $this->findPaymentByFileReferenceAndCustomerId(
            $getFileTransfer->getReference(),
            $getFileTransfer->getCustomerId()
        );

        if ($paymentEntity) {
            /** @var \SprykerEco\Zed\Payone\Business\Payment\MethodMapper\DirectDebit $paymentMethodMapper */
            $paymentMethodMapper = $this->getRegisteredPaymentMethodMapper(PayoneApiConstants::PAYMENT_METHOD_DIRECT_DEBIT);
            $requestContainer = $paymentMethodMapper->mapGetFile($getFileTransfer);
            $this->setStandardParameter($requestContainer);
            $rawResponse = $this->executionAdapter->sendRequest($requestContainer);
            $responseContainer->init($rawResponse);
        } else {
            $this->setAccessDeniedError($responseContainer);
        }

        $getFileTransfer->setRawResponse($responseContainer->getRawResponse());
        $getFileTransfer->setStatus($responseContainer->getStatus());
        $getFileTransfer->setErrorCode($responseContainer->getErrorcode());
        $getFileTransfer->setCustomerErrorMessage($responseContainer->getCustomermessage());
        $getFileTransfer->setInternalErrorMessage($responseContainer->getErrormessage());

        return $getFileTransfer;
    }
332233
public static function loadFile($file, $format = null)
    {
        if (!isset($format)) {
            $ext = pathinfo($file, PATHINFO_EXTENSION);
            $format = ArrayHelper::fetch(self::$FORMATS, $ext);
            if (!isset($format)) {
                throw new \InvalidArgumentException("Cannot infer format from file '{$file}'");
            }
        }
        if ($format == 'json') {
            return json_decode(file_get_contents($file), true);
        } elseif ($format == 'yaml') {
            return Yaml::parse(file_get_contents($file));
        } elseif ($format == 'php') {
            return require($file);
        } else {
            throw new \InvalidArgumentException("Invalid format '{$format}'");
        }
    }
996914
protected function getPaginatedBitmaps($zoomFactor , $format , $from , $to)
    {
        if ( $from > $to ) {
            throw new InvalidException('Start page for bitmaps must be inferior to end page');
        }

        $ret = array();
        try {
            $result = $this->getSoapClient()->GetBitmaps(array(
                'fromPage'   => ( integer ) $from ,
                'toPage'     => ( integer ) $to ,
                'zoomFactor' => ( integer ) $zoomFactor ,
                'format'     => ( string ) $format ,
            ));
        } catch ( SoapException $ex ) {
            throw new BitmapsException('Error while retrieving the final document as paginated bitmaps from Livedocx service' , $ex);
        }
        if ( isset($result->GetBitmapsResult->string) ) {
            $pageCounter = ( integer ) $from;
            if ( is_array($result->GetBitmapsResult->string) ) {
                foreach ( $result->GetBitmapsResult->string as $string ) {
                    $ret[ $pageCounter ] = base64_decode($string);
                    $pageCounter ++;
                }
            } else {
                $ret[ $pageCounter ] = base64_decode($result->GetBitmapsResult->string);
            }
        }

        return $ret;
    }
104155
public function get_file_by_id($fileid) {
        global $DB;

        $sql = "SELECT ".self::instance_sql_fields('f', 'r')."
                  FROM {files} f
             LEFT JOIN {files_reference} r
                       ON f.referencefileid = r.id
                 WHERE f.id = ?";
        if ($filerecord = $DB->get_record_sql($sql, array($fileid))) {
            return $this->get_file_instance($filerecord);
        } else {
            return false;
        }
    }
1220106
public function get($format = 'png')
    {
        $this->create();

        if ($format == 'jpg') {
            $format = 'jpeg';
        }

        if (!in_array($format, $this->image_types_available)) {
            $format = $this->image_type;
        }

        if (!function_exists('image'.$format)) {
            throw new Exception('QRCode: function image'.$format.' does not exists.');
        }

        ob_start();
        $success = call_user_func('image'.$format, $this->image);

        if ($success === false) {
            throw new Exception('QRCode: function image'.$format.' failed.');
        }

        $content = ob_get_clean();

        return $content;
    }
684859
public function getImage(string $format = null) : string
    {
        if (!$format) {
            $format = explode('/', $this->info['mime'], 2)[1];
        }
        switch (strtolower($format)) {
            case 'jpg':
            case 'jpeg':
                ob_start();
                imagejpeg($this->data);
                return ob_get_clean();
            case 'bitmap':
            case 'bmp':
                ob_start();
                imagewbmp($this->data);
                return ob_get_clean();
            case 'png':
                ob_start();
                imagepng($this->data);
                return ob_get_clean();
            case 'gif':
                ob_start();
                imagegif($this->data);
                return ob_get_clean();
            case 'webp':
                ob_start();
                imagewebp($this->data, null);
                return ob_get_clean();
            default:
                throw new ImageException('Unsupported format');
        }
    }
435769
def get_file_by_id(self, file_id):
        
        return self._create_item_response(
            self.data_service.get_file(file_id),
            File
        )
1125450
public function fget($handle, $remoteFile, $resumePosision = 0)
    {
        $mode = $this->getMode();
        $result = @ftp_fget($this->connection, $handle, $remoteFile, $mode, $resumePosision);
        
        if ($result === false) {
            throw new Exception('Unable to get file');
        }

        return $this;
    }
634054
public function getIp($format = self::FORMAT_HEX)
    {
        if ($this->ipHex === null) {
            return null;
        } elseif ($format === self::FORMAT_HEX) {
            return $this->ipHex;
        } elseif ($format === self::FORMAT_IP_STRING) {
            return inet_ntop($this->hex2bin($this->ipHex));
        }
        throw new \Exception('Invalid IP format');
    }