Skip to content

Add RemoteInput.open without cache - #24

Open
tikkss wants to merge 2 commits into
red-data-tools:mainfrom
tikkss:remote-input-open-without-cache
Open

Add RemoteInput.open without cache#24
tikkss wants to merge 2 commits into
red-data-tools:mainfrom
tikkss:remote-input-open-without-cache

Conversation

@tikkss

@tikkss tikkss commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

GitHub: GH-5

This patch will introduce the new high level API for IO like object (input only object, read only object).

RemoteInput.open downloads the data lazily on the first read. The data is stored in a system temporary directory and removed on close:

RemoteInput.open("https://example.com/sample/data.csv") do |input|
  input.read
end

RemoteInput#local_path returns a temporary file path:

RemoteInput.open("https://example.com/sample/data.csv") do |input|
  input.local_path
  # => /system temporary directory/red-remote-input/1234-567/data
  # 1234 is the process ID
  # 567 is the object ID
  # data is the fixed file name
end

Without a block, RemoteInput.open returns a RemoteInput object that must be closed explicitly:

input = RemoteInput.open("https://example.com/sample/data.csv")
input.read
input.close

GitHub: red-data-toolsGH-5

This patch will introduce the new high level API for IO like object
(input only object, read only object).

`RemoteInput.open` downloads the data lazily on the first read. The data
is stored in a system temporary directory and removed on close:

```ruby
RemoteInput.open("https://example.com/sample/data.csv") do |input|
  input.read
end
```

`RemoteInput::Input#local_path` returns a temporary file path:

```ruby
RemoteInput.open("https://example.com/sample/data.csv") do |input|
  input.local_path
  # => /system temporary directory/red-remote-input/1234-567/data
  # 1234 is the process ID
  # 567 is the object ID
  # data is the fixed file name
end
```

Without a block, `RemoteInput.open` returns a `RemoteInput::Input`
object that must be closed explicitly:

```ruby
input = RemoteInput.open("https://example.com/sample/data.csv")
input.read
input.close
```
@tikkss

tikkss commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

GitHub Actions was disabled when I opened this PR, so no workflows ran.
I've since enabled it, but since events aren't re-delivered, I'll close and reopen this PR to trigger CI.

@tikkss tikkss closed this Sep 1, 2026
@tikkss tikkss reopened this Sep 1, 2026
Comment thread lib/remote_input/input.rb Outdated
Because `RemoteInput::Input` is redundant.
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