Skip to content
Server-side implementation of the tus protocol in Lua
Perl Lua Shell Dockerfile
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/workflows
lib/tus
t
.gitignore
.luacheckrc
Dockerfile
LICENSE.txt
README.md
run_tests.sh

README.md

lua-tus-server

Server-side implementation of the tus protocol in Lua.

Features

  • tus protocol 1.0.0
  • 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

Synopsis

    lua_package_path "/path/to/lua-tus-server/lib/?.lua;;";
    lua_shared_dict tuslock 10m;

    server {
        location /upload/ {
            content_by_lua_block {
                local tus = require "tus.server"
                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

You can’t perform that action at this time.