Node.js
Node.js
Example: Http.QuickGetSb method
Demonstrates theQuickGetSb method.
Chilkat Node.js Downloads
NODEJS_PRELUDE
function chilkatExample() {
var success = false;
var http = new chilkat.Http();
// Send the HTTP GET and return the content in a StringBuilder
var sb = new chilkat.StringBuilder();
success = http.QuickGetSb("https://www.chilkatsoft.com/helloWorld.json",sb);
if (http.LastMethodSuccess == false) {
if (http.LastStatus == 0) {
// Communications error. We did not get a response.
console.log(http.LastErrorText);
}
else {
console.log("Response status code: " + http.LastStatus);
console.log("Response body error text:");
console.log(sb.GetAsString());
}
return;
}
// The downloaded content:
console.log(sb.GetAsString());
console.log("Success");
}
chilkatExample();