gpt4 book ai didi

ruby-on-rails - 下载大文件(~40MB)并使用回形针另存为附件

转载 作者:可可西里 更新时间:2023-11-01 16:19:55 26 4
gpt4 key购买 nike

我找到了一些代码`

require 'socket'
host = "download.thinkbroadband.com"
path = "/1GB.zip" # get 1gb sample file
request = "GET #{path} HTTP/1.0\r\n\r\n"
socket = TCPSocket.open(host,80)
socket.print(request)

# find beginning of response body
buffer = ""
while !buffer.match("\r\n\r\n") do
buffer += socket.read(1)
end

response = socket.read(100) #read first 100 bytes of body
puts response`

如何将回复的内容保存为回形针中的附件?

最佳答案

它可能不是您要找的东西,但您可能想查看 http://trevorturk.com/2008/12/11/easy-upload-via-url-with-paperclip/ .

关于ruby-on-rails - 下载大文件(~40MB)并使用回形针另存为附件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1141830/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com