Skip to content

A Lua client for Openrsty to upload file to Aliyun OSS storage, OpenResty的阿里云的OSS上传客户端

Notifications You must be signed in to change notification settings

lilien1010/lua-resty-oss-uploader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

lua aliyun OSS client[阿里云oss Lua 客户端,]

the HTTP client based on https://github.com/pintsized/lua-resty-http

useage

指定上传文件到阿里云的某个OSS存储节点,

example code

local	oss_upload 	=	require "resty.oss_upload"

local uploader  	= 	oss_upload:new(access_key_id,access_key_secret,bucket,timeOut,region)
   
local 	body 		=	'{}' 					-- [[这里可以是从其他地方获取的资源,url下载的文件,或者本地的文件,]]
   
local 	mimeType	=	'text/json'				--资源类型
   
local 	objectName 	=	'service_config.json'	-- 文件命名

local	startcall 	= 	ngx_now()*1000 
   
local url,err,upBody	=	uploader:upload(body,mimeType,objectName)
    

local	cost_time	=	ngx_now()*1000-startcall

ngx.log(ngx.INFO,',to=',bucket,',cost=',cost_time," OK  url=",objectName,',upBody=',upBody)
   

About

A Lua client for Openrsty to upload file to Aliyun OSS storage, OpenResty的阿里云的OSS上传客户端

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages