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

net - a Simple Version of the HTTP API

Started by houseofkraft, 31 August 2016 - 11:05 PM
houseofkraft #1
Posted 01 September 2016 - 01:05 AM
net - A Simple Version of the HTTP API

Ever think the HTTP API is so hard to use? So much commands to type, so much things to do. I thought of that and made a simple API called net. Net will download files using the HTTP API. For you it is like an easy version of the HTTP API.

This can be used to download raw files

DownloadTo download net just type in:
pastebin get Tfe71LAz net

Loading the APITo load the API into your program then at the start of your program type:
os.loadAPI("net")
You have to have the net API downloaded to do this

UsageUsage:
net.download(URL, Path)
net will return true or false depending if the download completed sucessfully and will save the file to the path and file name

ExampleSo say you wanted to download google.com
So you would have to load the API then type:
net.download("https://www.google.com", "/google")
that will save the file to /google because we told it to save it to /google

Everyone is allowed to use my API. Credit would be appreciated but it completely optional.

Thank You!
Edited on 11 September 2016 - 07:25 PM
Boom #2
Posted 01 September 2016 - 01:32 AM
Nice API :)/>
houseofkraft #3
Posted 01 September 2016 - 01:34 AM
Thank You!
Anavrins #4
Posted 01 September 2016 - 03:41 AM
And how do you get the content of a page if this only returns true or false?
houseofkraft #5
Posted 01 September 2016 - 12:48 PM
It saves it to a file

So say if i wanted to download google.com so i will load the API and then type:

net.download("https://www.google.com", "/google")

it would return true and save the file to google in the / directory
Anavrins #6
Posted 01 September 2016 - 03:27 PM
…… You're right, I must've been really tired when I posted that :P/>
rahph #7
Posted 01 September 2016 - 03:45 PM
Can I put the function from this API as en embed into my program?
I am writing a simple program manager to use with custom servers
houseofkraft #8
Posted 01 September 2016 - 11:49 PM
Sure. You can use my API in your program
TheRockettek #9
Posted 02 September 2016 - 12:59 PM
Im making a moreclean useful version of dis :^)