Skip to content

Library for ComputerCraft/CC: Tweaked that adds additional HTTP methodes

License

Notifications You must be signed in to change notification settings

PentagonLP/httputils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HTTPUtils

projectstage projectstage license issues
contributors activity lastcommit
size files languages

Library for the Minecraft mod ComputerCraft/CC: Tweaked including some additional HTTP Methodes

How to install

HTTPUtils can be installed using the ComputerCraft Package Tool by using the following commands:

Install CCPT, only run if you havn't installed it yet:

pastebin run syAUmLaF

Install the library:

ccpt install httputils

The library will now be stored in "/lib/httputils". It depends on "fileutils", which will be installed automaticly with HTTPUtils.

How to use

https://github.com/PentagonLP/httputils/blob/main/testing/testdata will be used in all examples:

{
	greeting = "'ello"
}

1. Get table from URL

The function gethttpdata([url]) returns the parsed table fetched from the given URL. If an error occures, the errormessage is printed in console and false is returned.

Example:

Example code and output:
missing image :(

2. Download file from URL

The function downloadfile([filepath],[url]) downloads a file from the given URL and stores it in the given filepath. If an error occures, the errormessage is printed in console and false is returned.

Example:

Example code and output:
missing image :(

Content of "test":

{
	greeting = "'ello"
}

3. Get Http result from URL

The function gethttpresult([url]) returns the raw result fetched from the given URL. If an error occures, the errormessage is printed in console and false is returned. This is only a helper methode; It only differs from http.get([url]) because it does some additional error checking.

Example:

Example code and output:
missing image :(

Changelog

Nothing here yet, we are still on 1.0 :)

Last words

First of all, thanks for reading! This library is not the biggest library ever, but it turned out to be really useful for one of my projects, and maybe it is for yours too :)
If you find bugs, please create an issue so I can fix them.
I'm still very new to Github, so feel free to point out things I could do better. Also, english is not my first language, so if you find any spelling/language-related mistakes, please do also create an issue.
Have a nice day,
PentagonLP

About

Library for ComputerCraft/CC: Tweaked that adds additional HTTP methodes

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages