Skip to content

File I O and Web Requests

Landon Powell edited this page Sep 6, 2016 · 1 revision

The loadFile or open function

The loadFile function takes a string as an argument, uses it as the filename, and returns a 'file' datatype as an output.

The saveFile or save function

The saveFile takes a 'file' datatype as an argument, looks up the file, and saves the file using it's filename. It returns the 'file' that it took as input.

The get request function

The get request function takes a string as an argument, uses it as the domain name, and all arguments afterwards are headers. It returns a 'website' datatype, which includes a domain name, headers, and file contents.

The post request function

The post request function takes a string as an argument, uses it as the domain name, and all arguments afterwards are used as elements of the post request. It returns a 'website' datatype, just like get requests.

The postForm request function

Effectively, this functions the same way as the post request function, but it takes a tree as the second argument, and uses that as the values of the form.