Add upyun new2

This commit is contained in:
XiaoLi
2024-01-03 23:18:02 +08:00
committed by XiaoLi
parent ffab75c78a
commit dd27afb222
3 changed files with 115 additions and 33 deletions
+18 -18
View File
@@ -34,19 +34,19 @@ end
local function upyun_remove_file()
-- 使用 os.tmpname 获取临时文件名
local tempFileName = "upyun_remove_temp_file"
-- 拼接路径
local tempFilePath = "/tmp/" .. tempFileName
-- 使用 io.open 创建临时文件
local tempFile = io.open(tempFilePath, "w")
-- 写入内容到临时文件
tempFile:write("upyun new config local temp file")
-- 关闭文件
tempFile:close()
-- 使用 os.execute 执行 chmod 命令
os.execute("chmod 777 " .. tempFilePath)
--print("Upyun new config local temp file path : ", tempFilePath)
---- 使用 os.tmpname 获取临时文件名
--local tempFileName = "upyun_remove_temp_file"
---- 拼接路径
--local tempFilePath = "/tmp/" .. tempFileName
---- 使用 io.open 创建临时文件
--local tempFile = io.open(tempFilePath, "w")
---- 写入内容到临时文件
--tempFile:write("upyun new config local temp file")
---- 关闭文件
--tempFile:close()
---- 使用 os.execute 执行 chmod 命令
--os.execute("chmod 777 " .. tempFilePath)
----print("Upyun new config local temp file path : ", tempFilePath)
local config = {
--user = ngx.var.upyun_operator,
@@ -55,11 +55,11 @@ local function upyun_remove_file()
passwd = "NyJ51zRwFApY9Wo9EHJMrb8GI9YtvpVN",
--localFilePath = "/file_upload/abc.mp3"
--localFilePath = "/Users/liyong/Code/AlchemyStudio/resty_functions/test_files_dir/r2d2.jpeg"
localFilePath = tempFilePath
--localFilePath = nil
--localFilePath = tempFilePath
localFilePath = nil
}
local upyun = yun:new(config)
local upyun = yun:new2(config)
--local bucket = ngx.var.upyun_bucket
local bucket = "moicen"
local directory = 'test'
@@ -75,6 +75,6 @@ local function upyun_remove_file()
end
upyun_upload_file()
--upyun_upload_file()
--upyun_remove_file()
upyun_remove_file()