Skip to content

Commit

Permalink
Merge pull request #138 from deonthomasgy/main
Browse files Browse the repository at this point in the history
fix uploading gz snapshot
  • Loading branch information
freekmurze authored Mar 27, 2023
2 parents c2156b5 + a0a3de2 commit e928f61
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/Snapshot.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,14 @@ protected function shouldIgnoreLine(string $line): bool
protected function loadStream(string $connectionName = null)
{
LazyCollection::make(function () {
$stream = $this->disk->readStream($this->fileName);
$stream = $this->compressionExtension === 'gz'
? gzopen($this->disk->path($this->fileName), 'r')
: $this->disk->readStream($this->fileName);

$statement = '';
while (! feof($stream)) {
$chunk = $this->compressionExtension === 'gz'
? gzdecode(gzread($stream, self::STREAM_BUFFER_SIZE))
? gzread($stream, self::STREAM_BUFFER_SIZE)
: fread($stream, self::STREAM_BUFFER_SIZE);

$lines = explode("\n", $chunk);
Expand Down

0 comments on commit e928f61

Please sign in to comment.