diff --git a/README.markdown b/README.markdown index 3fab519..7c4c965 100644 --- a/README.markdown +++ b/README.markdown @@ -29,6 +29,7 @@ Note that at least [ngx_lua 0.7.9](https://github.com/chaoslawful/lua-nginx-modu Synopsis ======== +```lua lua_package_path "/path/to/lua-resty-redis/lib/?.lua;;"; server { @@ -67,9 +68,11 @@ Synopsis '; } } +``` A typical output of the /test location defined above is: +```json read: ["header",["Content-Disposition","form-data; name=\"file1\"; filename=\"a.txt\"","Content-Disposition: form-data; name=\"file1\"; filename=\"a.txt\""]] read: ["header",["Content-Type","text\/plain","Content-Type: text\/plain"]] read: ["body","Hello"] @@ -82,9 +85,11 @@ A typical output of the /test location defined above is: read: ["part_end"] read: ["eof"] read: ["eof"] +``` You can use the [lua-resty-string](https://github.com/agentzh/lua-resty-string) library to compute SHA-1 and MD5 digest of the file data incrementally. Here is such an example: +```lua local resty_sha1 = require "resty.sha1" local upload = require "resty.upload" @@ -130,6 +135,7 @@ You can use the [lua-resty-string](https://github.com/agentzh/lua-resty-string) -- do nothing end end +``` If you want to copmute MD5 sums for the uploaded files, just use the resty.md5 module shipped by the lua-resty-string library. It has