This object allows you to download data.
Constructor function.
var myObject = new Web(eventsAndOptions);
var myObject = new Web();
var myObject = new Web({ onFinished: function() { Console.print("Finished!"); }, file: "myFile.txt" });
Start downloading.
myObject.download(url, options);
myObject.download(url);
This method is asynchronous, this means that it will return before the data is downloaded. To know when this is done use the onFinished event or the isDownloading method.
Returns true if the data is still being downloaded.
myObject.isDownloading();
Returns the downloaded data as an Image.
myObject.toImage();
You cannot use this method if you specified a destination file as no data is kept in memory.
Returns the downloaded data as text.
myObject.toText(encoding);
myObject.toText();
You cannot use this method if you specified a destination file as no data is kept in memory.
Returns the downloaded data as RawData.
myObject.toRawData();
You cannot use this method if you specified a destination file as no data is kept in memory.
Cancel the download.
myObject.cancel();
Called when the data has been downloaded.
myObject.onFinished = function() {};
myObject.onFinished = function() { //Event action };
Called when the download progression has changed.
myObject.onDownloadProgress = function(bytesReceived, bytesTotal) {};
myObject.onDownloadProgress = function(bytesReceived, bytesTotal) { //Event action };
Called when an error occurs.
myObject.onError = function(errorText) {};
myObject.onError = function(errorText) { //Event action };
The download method.