Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Streaming Google storage upload

未关闭
#759 18 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
停滞
技术栈
ruby
领域
cloud

调研方向

阅读 google-cloud-ruby issue #1997 中描述的限制,并检查链接的 gcs_stream_upload wrapper,以其 streaming 示例作为起点。当 Google storage 上传能够写入流式传输的数据而无需将完整内容保留在内存中(包括通过 IO.copy_stream 生成的数据)时,即表示完成。

由索引模型根据 Issue 内容生成。

描述

type: feature request

I am trying to solve the case of uploading files in a streaming fashion without keeping the full contents in memory

I have previously implemented the same feature in https://github.com/aws/aws-sdk-ruby/pull/1711

As identified in https://github.com/googleapis/google-cloud-ruby/issues/1997
There are some limitations in google-api-client which hard codes the use of the content length header

I have written a minimal wrapper library that monkey patches it here which should serve as a good source of inspiration: https://github.com/Fonsan/gcs_stream_upload

require 'gcs_stream_upload'

storage = Google::Cloud::Storage.new(timeout: 5 * 60)
bucket = storage.bucket('bucket')
gcs_stream_upload = GCSStreamUpload.new(bucket)

gcs_stream_upload.upload('object') do |io|
 IO.copy_stream(IO.popen('yes | head -n 10'), io)
end
# => Written "y\n" * 10


gcs_stream_upload.upload('object') do |io|
 io << 'data'
 io << 'dat2'
end
# => Written "datadat2"
主要语言
Ruby
星标
2.9k
派生
888
平均合并
8 分钟
30 天内合并 PR
242

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

googleapis/google-api-ruby-client 的其他 Issue

查看 googleapis/google-api-ruby-client 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。