{"id":13777669,"url":"https://github.com/rainingmaster/NetStorageKit-Lua","last_synced_at":"2025-05-11T11:33:57.115Z","repository":{"id":88266199,"uuid":"225308273","full_name":"rainingmaster/NetStorageKit-Lua","owner":"rainingmaster","description":"Netstorage API for Lua(base on Openresty)","archived":false,"fork":false,"pushed_at":"2020-02-05T09:42:02.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-02-15T02:31:23.630Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Lua","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rainingmaster.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2019-12-02T07:07:51.000Z","updated_at":"2020-02-05T09:42:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"e3d3a5d8-1afd-4e1e-a1c0-1ec4cdadb7ea","html_url":"https://github.com/rainingmaster/NetStorageKit-Lua","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rainingmaster%2FNetStorageKit-Lua","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rainingmaster%2FNetStorageKit-Lua/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rainingmaster%2FNetStorageKit-Lua/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rainingmaster%2FNetStorageKit-Lua/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rainingmaster","download_url":"https://codeload.github.com/rainingmaster/NetStorageKit-Lua/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253559174,"owners_count":21927540,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T18:00:46.937Z","updated_at":"2025-05-11T11:33:56.775Z","avatar_url":"https://github.com/rainingmaster.png","language":"Lua","readme":"Name\n====\n\nNetStorageKit-Lua\n\nTable of Contents\n=================\n\n* [Name](#name)\n* [Description](#description)\n* [Synopsis](#synopsis)\n* [Modules](#methods)\n    * [resty.netstorage](#netstorage)\n        * [Methods](#methods)\n            * [new](#new)\n            * [dir](#dir)\n            * [du](#du)\n            * [stat](#stat)\n            * [mkdir](#mkdir)\n            * [rmdir](#rmdir)\n            * [mtime](#mtime)\n            * [delete](#delete)\n            * [quick_delete](#quick_delete)\n            * [rename](#rename)\n            * [symlink](#symlink)\n            * [download](#download)\n            * [upload](#upload)\n            * [set_keepalive](#set_keepalive)\n* [Installation](#installation)\n* [Copyright and License](#copyright-and-license)\n* [See Also](#see-also)\n\nDescription\n========\n\nNetStorageKit-Lua is Akamai Netstorage (File/Object Store) API for Lua(Openresty). And this module is ported from [netstoragekit-golang](http://github.com/akamai/netstoragekit-golang). Before using this module, [lua-resty-http](https://github.com/ledgetech/lua-resty-http) and [lua-resty-hmac](https://github.com/jkeys089/lua-resty-hmac) should be installed.\n\nSynopsis\n========\n\nList the environment variable name in nginx.conf file via the [env directive](https://nginx.org/en/docs/ngx_core_module.html#env) for accessing in lua.\n\nAdd configs in `main block`\n\n```nginx\n    env NS_KEY;\n    env NS_HOST;\n    env NS_KEYNAME;\n```\n\nAdd configs in `http block`\n\n```lua\n    lua_package_path \"/path/to/NetStorageKit-Lua/lib/?.lua;;\";\n\n    server {\n        location /test {\n            content_by_lua_block {\n                local netstorage = require(\"resty.netstorage\")\n\n                -- Get parameters from os evironment, you can change to your own private value.\n                local ns, err = netstorage:new({\n                    key = os.getenv(\"NS_KEY\"),\n                    key_name = os.getenv(\"NS_KEYNAME\"),\n                    host = os.getenv(\"NS_HOST\"),\n                    ssl = true,\n                })\n                if not ns then\n                    ngx.log(ngx.ERR, \"init failed: \", err)\n                    return ngx.exit(500)\n                end\n\n                local _, err, code = ns:upload(\"/10000/new_file\", \"hello netstorage here!\")\n                if err or code ~= 200 then\n                    ngx.log(ngx.ERR, \"upload failed: \", err, \", code: \", code)\n                    return ngx.exit(500)\n                end\n\n                ngx.print(\"success\")\n                ns:set_keepalive()\n            }\n        }\n    }\n```\n\n[Back to TOC](#table-of-contents)\n\nModules\n=======\n\n[Back to TOC](#table-of-contents)\n\nresty.netstorage\n--------\n\n[Back to TOC](#table-of-contents)\n\n### Methods\n\n[Back to TOC](#table-of-contents)\n\n#### new\n\n[Back to TOC](#table-of-contents)\n\n#### dir\n\n[Back to TOC](#table-of-contents)\n\n#### du\n\n[Back to TOC](#table-of-contents)\n\n#### stat\n\n[Back to TOC](#table-of-contents)\n\n#### mkdir\n\n[Back to TOC](#table-of-contents)\n\n#### rmdir\n\n[Back to TOC](#table-of-contents)\n\n#### mtime\n\n[Back to TOC](#table-of-contents)\n\n#### delete\n\n[Back to TOC](#table-of-contents)\n\n#### quick_delete\n\n[Back to TOC](#table-of-contents)\n\n#### rename\n\n[Back to TOC](#table-of-contents)\n\n#### symlink\n\n[Back to TOC](#table-of-contents)\n\n#### download\n\n[Back to TOC](#table-of-contents)\n\n#### upload\n\n[Back to TOC](#table-of-contents)\n\n#### delete\n\n[Back to TOC](#table-of-contents)\n\n#### set_keepalive\n\n[Back to TOC](#table-of-contents)\n\nInstallation\n====\n\nexport LUA_LIB_DIR=/path/to/lualib \u0026\u0026 make install\n\n[Back to TOC](#table-of-contents)\n\nTODO\n====\n\n[Back to TOC](#table-of-contents)\n\nCopyright and License\n=====================\n\nThis module is licensed under the BSD license.\n\nCopyright (C) 2018-2018, by rainingmaster.\n\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n[Back to TOC](#table-of-contents)\n\nSee Also\n========\n* the ngx_lua module: https://github.com/openresty/lua-nginx-module/#readme\n* [netstorage-http-api-developer-guide](https://learn.akamai.com/en-us/webhelp/netstorage/netstorage-http-api-developer-guide/GUID-22B017EE-DD73-4099-B96D-B5FD91E1ED98.html)\n* [lua-resty-core](https://github.com/openresty/lua-resty-core)\n* [lua-resty-http](https://github.com/ledgetech/lua-resty-http)\n* [lua-resty-hmac](https://github.com/jkeys089/lua-resty-hmac)\n\n[Back to TOC](#table-of-contents)\n\n","funding_links":[],"categories":["Libraries"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frainingmaster%2FNetStorageKit-Lua","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frainingmaster%2FNetStorageKit-Lua","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frainingmaster%2FNetStorageKit-Lua/lists"}