{"id":"joesmaller/httputil","name":"httputil","scope":"joesmaller","platform":"roblox","description":"A library for dealing with HttpService for Roblox Luau","version":"0.1.0","latest":"0.1.0","versions":["0.1.0"],"license":"MIT","licenseRating":"safe","licenseCaveats":["License identified from the packaged LICENSE file; the manifest declared none."],"licenseVerified":true,"dependencies":{"evaera/promise":{"version":"^4.0.0","alias":"Promise"}},"integrity":"e6776ddc292240ff31dbc0121e62b1ef448e36c3812040f3d717ce1d140465c2","likes":0,"downloads":0,"install":"forest install joesmaller/httputil","url":"https://forest.dev/p/roblox/joesmaller/httputil","files":"https://api.forest.dev/ai/package/roblox/joesmaller/httputil/files","readme":"# HttpUtil\nA library for dealing with HttpService for Roblox Luau.\n\nThis is a basic library that contains a number of different functions to help with using HttpService. One such allows you to download a GitHub repository, which can be useful for loading in .json files within a running server.\n\n\n## Installation\n\n**Rojo**\n\nCopy the repository to your project, then point the `default.project.json` file to reside within the `ServerPackages` folder of your project. See `example.project.json` for an example.\n\n**Wally**\n\nA wally package is planned which will make it much easier to install.\nAssuming everything goes to plan, you should be able to add the library to your `wally.toml` ServerDependancy list (for instance: `HttpUtil = \"joesmaller/httputil@^1\"`).\n\n\n## Usage\n\nOne example would be loading `.json` files from a github repository.\nWe provide a repository name along with an _optional_ directory path (which is just a folder).\nWe can also provide an _optional_ [Github Personal Access Token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token) which will allow us to access private repositories (that the token has access to), along with an increased rate limit.\n\nWe can also provde a simple settings table that lets us add file/directory whitelists/blacklists that only allow the download of files or folders that match. For instance, adding `.json` to the file whitelist to ensure we only get `.json` files, but we can even add `.project.json` files to avoid downloading those.\n\nAlso within the settings table is a MaximumDepth number, which is how far deep down into the repository (starting for whatever directory was chosen) we should go. This is Lua, so it starts at 1.\n\nThe library also has a function that attempts to convert a `.csv` file into a [LocalizationTable](https://create.roblox.com/docs/reference/engine/classes/LocalizationTable) instance, by default it will use a comman (',') to seperate the cells, but an optional seperator character can be provided within the settings.\n\n```lua\nlocal HttpUtil = require(PATH_TO_MODULE)\n\nlocal REPOSITORY = \"joesmaller/HttpUtil\"\nlocal DIRECTORY = \"src\"\nlocal GITHUB_TOKEN = \"ghp_sUp3r5ekRet...\"\nlocal SETTINGS = {\n\tMaximumDepth = 4;\n\tFileWhitelist = {\".json\"},\n\tCSV = {\n\t\tSeperator = \";\"\n\t}\n}\n\nHttpUtil.getGithubRepository(REPOSITORY, DIRECTORY, GITHUB_TOKEN, SETTINGS)\n:andThen(function(repository)\n\t-- do things with that repository!!!\nend)\n:catch(function(errorMessage)\n\t-- oh no something went wrong!\n\twarn(errorMessage)\nend)\n```","readmeTruncated":false}