synpixel / rbx-fetch

HttpService wrapper for Roblox

Home Page:https://synpixel.github.io/rbx-fetch/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fetch

Lightweight HttpService wrapper for Roblox

View docs →

Installation

Wally

Put fetch inside your Wally dependencies, as so:

fetch = "synpixel/fetch@0.2.3"

Examples

Fetching a JSON response

fetch("https://dummyjson.com/products/1")
	:andThen(function(response: fetch.Response)
		local product = response.json():expect()
		print(product)
	end)
	:catch(function(response: fetch.Response)
		warn("Failed to fetch data")
	end)

Fetching a PNG data response

fetch("https://rojo.space/img/logo.png")
    :andThen(function(response: fetch.Response)
        local image = response.image():expect()
        print(image.Width, image.Height)
    end)
    :catch(function(response: fetch.Response)
        warn("Failed to fetch data")
    end)

About

HttpService wrapper for Roblox

https://synpixel.github.io/rbx-fetch/

License:MIT License


Languages

Language:Lua 100.0%