{"id":20439401,"url":"https://github.com/skitsanos/lua-fs-utils","last_synced_at":"2026-04-15T18:01:33.638Z","repository":{"id":65252672,"uuid":"589022809","full_name":"skitsanos/lua-fs-utils","owner":"skitsanos","description":"Lua File System utilities, OpenResty-ready","archived":false,"fork":false,"pushed_at":"2026-03-02T07:06:12.000Z","size":22,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-02T11:43:31.444Z","etag":null,"topics":["lfs","lua","luafilesystem","luajit","nginx","nginx-lua","nginx-luajit","openresty"],"latest_commit_sha":null,"homepage":"","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/skitsanos.png","metadata":{"files":{"readme":"README.md","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,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-01-14T20:07:26.000Z","updated_at":"2026-03-02T07:06:11.000Z","dependencies_parsed_at":"2025-01-15T19:22:40.815Z","dependency_job_id":"c2dca62d-76ad-4d47-b7ae-f3264aab9209","html_url":"https://github.com/skitsanos/lua-fs-utils","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/skitsanos/lua-fs-utils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skitsanos%2Flua-fs-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skitsanos%2Flua-fs-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skitsanos%2Flua-fs-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skitsanos%2Flua-fs-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skitsanos","download_url":"https://codeload.github.com/skitsanos/lua-fs-utils/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skitsanos%2Flua-fs-utils/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31853279,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"ssl_error","status_checked_at":"2026-04-15T15:24:39.138Z","response_time":63,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["lfs","lua","luafilesystem","luajit","nginx","nginx-lua","nginx-luajit","openresty"],"created_at":"2024-11-15T09:17:10.003Z","updated_at":"2026-04-15T18:01:33.615Z","avatar_url":"https://github.com/skitsanos.png","language":"Lua","readme":"# Lua File System Utils\n\nThe fs module is a set of functions that provide various file system related functionality, such as finding, reading,\nwriting and streaming files.\n\n### Functions\n\n**find(path, name)**\n\nThe find function searches for a file with the given name in the directory specified by path. It returns the full path\nto the file if it is found, otherwise it returns nil.\n\n```lua\nlocal path = fs.find('/home/user', 'example.txt')\nprint(path) -- '/home/user/example.txt'\n```\n\n**fileName(path)**\n\nThe fileName function takes a file path as an argument and returns the file name from the path.\n\n```lua\nlocal fileName = fs.fileName('/home/user/example.txt')\nprint(fileName) -- 'example.txt'\n```\n\n**fileExtension(path)**\n\nThe fileExtension function takes a file path as an argument and returns the file extension from the path.\n\n```lua\nlocal fileExtension = fs.fileExtension('/home/user/example.txt')\nprint(fileExtension) -- 'txt'\n```\n\n**readAsText(path)**\n\nThe readAsText function reads the file at the specified path and returns its content as a string.\n\n```lua\nlocal fileContent = fs.readAsText('/home/user/example.txt')\nprint(fileContent) -- 'This is an example text file.'\n```\n\n**readAsJson(path)**\n\nThe readAsJson function reads the file at the specified path, converts it to a JSON object, and returns the object.\n\n```lua\nlocal fileContent = fs.readAsJson('/home/user/example.json')\nprint(fileContent) -- { name: \"example\", value: 42 }\n```\n\n**read(path, binary)**\n\nThe read function reads the file at the specified path and returns its content as an array of bytes. If the binary\nparameter is set to true, the file will be read in binary mode, otherwise it will be read in text mode.\n\nReading binary file:\n\n```lua\nlocal fileContent = fs.read('/home/user/example.bin', true)\nprint(fileContent) -- { 0x01, 0x02, 0x03, ... }\n```\n\nReading file as text, similar to `readAsText`:\n\n```lua\nlocal fileContent = fs.read('/home/user/example.txt', false)\nprint(fileContent) -- 'This is an example text file.'\n```\n\n**write(path, content)**\n\nThe write function writes the content to the file at the specified path.\n\n```lua\nfs.write('/home/user/example.txt', 'This is new content')\n```\n\n**exists(path)**\n\nThe exists function checks if the file or directory at the specified path exists and returns true if it does, otherwise\nfalse.\n\n```lua\nlocal exists = fs.exists('/home/user/example.txt')\nprint(exists) -- true\n```\n\n**filesCount(path)**\n\nThe filesCount function returns the number of files in a given folder path.\n\n```lua\nlocal filesCount = fs.filesCount('/home/user')\nprint(filesCount) -- 3\n```\n\n**matchSignature(path, signature)**\n\nThe matchSignature function accepts a path — a path to the file and signature - array of bytes. It checks if the path is\nfile, and it exists, then checks if file content starts with 'signature'. return true if matched, otherwise\n\n```lua\nlocal match = fs.matchSignature('/home/user/example.txt', { 'T', 'h', 'i', 's', ' ', 'i', 's' })\nprint(match) -- true\n```\n\n**stream(path, chunkSize)**\n\nStreams file to stdout or, if running under openresty to the user, the chunkSize is optional\n\n```lua\nfs.stream('/home/user/example.mp4',8192)\n```","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskitsanos%2Flua-fs-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskitsanos%2Flua-fs-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskitsanos%2Flua-fs-utils/lists"}