1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Faraday で s3 の公開領域にバイナリを PUT する

Posted at

よくよく考えたら当然のことだが、multipart では PUT できない。

Faraday.new(url: s3_url).put do |req|
  req.header['Content-Type'] = 'application/octet-stream'
  req.body = File.binread('/path/to/file')
end

Content-Type は PUT するバイナリの Content Type に合わせる。

セキュアな bucket に PUT したい場合、Authorization ヘッダがさらに必要になる。

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?