Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mmatuska/lua-tus-server
Server-side implementation of the tus protocol in Lua
https://github.com/mmatuska/lua-tus-server
Last synced: about 1 month ago
JSON representation
Server-side implementation of the tus protocol in Lua
- Host: GitHub
- URL: https://github.com/mmatuska/lua-tus-server
- Owner: mmatuska
- License: mit
- Created: 2019-09-30T08:30:17.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-03-20T12:31:47.000Z (over 4 years ago)
- Last Synced: 2024-02-14T18:34:20.613Z (9 months ago)
- Language: Perl
- Size: 94.7 KB
- Stars: 9
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
- awesome-resty - lua-tus-server - Server-side implementation of the tus protocol in Lua (Libraries)
README
# lua-tus-server
Server-side implementation of the [tus](https://tus.io/) protocol in Lua.
## Features
- [tus protocol 1.0.0](https://tus.io/protocols/resumable-upload.html)
- tus extensions:
- checksum (md5, sha1, sha256)
- concatenation
- concatenation-unfinished
- creation
- creation-defer-length
- expiration
- termination
- each tus extension can be individually disabled
- resource locking via NGINX Lua shared memoy zones
- soft and hard deleteion of resources## Requiremens
- [OpenResty](https://openresty.org) or [NGINX](https://www.nginx.com) with [mod\_lua](https://github.com/openresty/lua-nginx-module)
- [lua-resty-string](https://github.com/openresty/lua-resty-string)
- [lua-cjson](https://www.kyne.com.au/~mark/software/lua-cjson.php)## Synopsis
```lua
lua_package_path "/path/to/lua-tus-server/lib/?.lua;;";
lua_shared_dict tuslock 10m;server {
location /upload/ {
content_by_lua_block {
local tus_server = require "tus.server"
local tus = tus_server:new()
tus.config.storage_backend = "tus.storage_file"
tus.config.storage_backend_config.storage_path = "/tmp"
tus.config.storage_backend_config.lock_zone = ngx.shared.tuslock
tus.config.upload_url = "/upload"
tus.config.expire_timeout = 1209600
tus:process_request()if tus.resource.name and tus.resource.state == "completed" then
local path = tus.sb:get_path(tus.resource.name)
os.rename(path, "/tmp/newfile")
tus.sb:delete(tus.resource.name)
end
}
}
}
```## Todo
- concatenation does not merge the resources yet
## License
MIT