Skip to content

Add RemoteInput#seek - #43

Merged
kou merged 1 commit into
red-data-tools:mainfrom
tikkss:add-seek
Nov 22, 2026
Merged

kou merged 1 commit into
red-data-tools:mainfrom
tikkss:add-seek

Conversation

@tikkss

@tikkss tikkss commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

GitHub: GH-5

It's like IO#seek and passes all arguments to IO#seek.

We need this to read a file in a tar.gz RemoteInput, because Zlib::GzipReader#rewind moves back an input with IO#seek.

RemoteInput.open("https://example.com/data.tar.gz") do |input|
  Zlib::GzipReader.wrap(input) do |reader|
    Gem::Package::TarReader.new(reader) do |tar|
      # This calls `reader.rewind` after the block.
      # `reader.rewind` calls `input.seek`.
      tar.seek("data.txt") do |entry|
        # ...
      end
    end
  end
end

GitHub: red-data-toolsGH-5

It's like `IO#seek` and passes all arguments to `IO#seek`.

We need this to read a file in a tar.gz `RemoteInput`, because
`Zlib::GzipReader#rewind` moves back an input with `IO#seek`.

```ruby
RemoteInput.open("https://example.com/data.tar.gz") do |input|
  Zlib::GzipReader.wrap(input) do |reader|
    Gem::Package::TarReader.new(reader) do |tar|
      # This calls `reader.rewind` after the block.
      # `reader.rewind` calls `input.seek`.
      tar.seek("data.txt") do |entry|
        # ...
      end
    end
  end
end
```
@kou
kou merged commit 61be1d4 into red-data-tools:main Nov 22, 2026
9 checks passed
@tikkss
tikkss deleted the add-seek branch November 22, 2026 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants