11 lines
371 B
Lua
11 lines
371 B
Lua
|
|
-- retrieve the content of a URL
|
||
|
|
local http = require("socket.http")
|
||
|
|
local body, code = http.request("https://upyun.alchemy-studio.cn/music-room/17c832cb-bc6b-41f7-96cd-190b7fe4a3d7.jpeg?_upt=e487088a1661273055")
|
||
|
|
if not body then error(code) end
|
||
|
|
|
||
|
|
-- save the content to a file
|
||
|
|
local f = assert(io.open('test.jpg', 'wb')) -- open in "binary" mode
|
||
|
|
f:write(body)
|
||
|
|
|
||
|
|
f:close()
|