Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.12] AbstractBinaryInput::getRawBinary() #632

Merged
merged 3 commits into from
Nov 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/PageUtils/AbstractBinaryInput.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ public function getResponseReader(): ResponseReader
/**
* Get base64 representation of the file.
*
* @param int|null $timeout
*
* @return mixed
*/
public function getBase64(int $timeout = null)
public function getBase64(?int $timeout = null)
{
$response = $this->responseReader->waitForResponse($timeout);

Expand All @@ -54,10 +56,23 @@ public function getBase64(int $timeout = null)
return $response->getResultData('data');
}

/**
* Get raw binary data.
*
* @param int|null $timeout
*
* @return string
*/
public function getRawBinary(int $timeout = null): string
{
return \base64_decode($this->getBase64($timeout), true);
}

/**
* Save data to the given file.
*
* @param string $path
* @param int $timeout
*
* @throws FilesystemException
* @throws ScreenshotFailed
Expand Down
Loading