Forest Logo
search
package_2

httputil

By @joesmaller

Roblox

Mirrored

HttpUtil

A library for dealing with HttpService for Roblox Luau.

This 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.

Installation

Rojo

Copy 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.

Wally

A wally package is planned which will make it much easier to install. Assuming everything goes to plan, you should be able to add the library to your wally.toml ServerDependancy list (for instance: HttpUtil = "joesmaller/httputil@^1").

Usage

One example would be loading .json files from a github repository. We provide a repository name along with an optional directory path (which is just a folder). We can also provide an optional Github Personal Access Token which will allow us to access private repositories (that the token has access to), along with an increased rate limit.

We 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.

Also 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.

The library also has a function that attempts to convert a .csv file into a LocalizationTable instance, by default it will use a comman (',') to seperate the cells, but an optional seperator character can be provided within the settings.

local HttpUtil = require(PATH_TO_MODULE)

local REPOSITORY = "joesmaller/HttpUtil"
local DIRECTORY = "src"
local GITHUB_TOKEN = "ghp_sUp3r5ekRet..."
local SETTINGS = {
	MaximumDepth = 4;
	FileWhitelist = {".json"},
	CSV = {
		Seperator = ";"
	}
}

HttpUtil.getGithubRepository(REPOSITORY, DIRECTORY, GITHUB_TOKEN, SETTINGS)
:andThen(function(repository)
	-- do things with that repository!!!
end)
:catch(function(errorMessage)
	-- oh no something went wrong!
	warn(errorMessage)
end)

Package Details

Install command (Click to copy)


Version

0.1.0

License

MIT

check_circle

Safe for commercial use

infoLicense identified from the packaged LICENSE file; the manifest declared none.

Automated license review — not legal advice.