This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
thecrimulo's profile picture

fURL - Download http content, easy as never!

Started by thecrimulo, 02 July 2016 - 01:10 AM
thecrimulo #1
Posted 02 July 2016 - 03:10 AM
So, after a long research and 4am in my timezone, I've made my own HTTP content downloader, fURL.

I know, there are others like wget and Github downloader… BUT!… They didn't work for me, either bad indentation, or fails at install, or blah. So I made fURL: Fetch URL.


furl https://example.org example
That simple, to download a file! It only works with plain text tho.

But, this is not all, it also comes with libfurl, which has 4 easy functions: fetch(url), save(h, fo), dl(url, fo) and ghfetch(user, repo, branch, file, fo, class)

fetch(url) returns a string with the url content, it doesn't save it.
save(h, fo): h is the string (that fetch returns, or can be any) and fo is the file object [local fileo = fs.open(path, "w")]
dl(url, fo) is the combined result, gets an url and a file object.
ghfetch(…) is more complex:
- user: GitHub account
- repo: Gh repo
- branch: Repo's branch
- file: File.
- fo: File Object
- class: If class == "moonux", user = "TheCrimulo" and repo = "moonux", this is only for my purposes, but you can put yours.

Installation:

libfurl:
pastebin get UtzfuGJc
furl [Depends on libfurl]:
pastebin get JekYNUWn
In root directory:
mkdir lib
mv libfurl /lib/libfurl

You can use it freely on your PC. If it's a tool for an OS, please credit Moonux Boottools and thecrimulo.
DannySMc #2
Posted 02 July 2016 - 07:55 PM
You do understand that the installation could be simplified for the end user by making an installer for it?

Also nice though, like it a lot!!
Edited on 02 July 2016 - 05:55 PM