←  APIs and Utilities

ComputerCraft | Programmable Computers for Minecraft

»

fURL - Download http content, easy as never!

thecrimulo's Photo thecrimulo 02 Jul 2016

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

Dahknee's Photo Dahknee 02 Jul 2016

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 by DannySMc, 02 July 2016 - 06:55 PM.
Quote