ssCore.HTTP.getContentLength

Find out how much data will be returned before starting the actual download.


Availability:

First available in version 3.0 build 2039.


Input Parameters:

None.


Output Parameters:

result - The number of bytes that will be returned by HTTP.read. Valid values are "-1" (length unknown) or a positive value that is the length in bytes of the remote resource identified by HTTP.resource.


Asynchronous Mode:

When this method is called asynchronously, a return object containing the output parameters is passed to the specified callback function.

ssCore.HTTP.getContentLength( paramsObject [, callbackParamsObject] [, errorParamsObject] );


Synchronous Mode:

This method can only be called asynchronously.


Notes:

If the number of bytes returned is "-1", the content length is unknown. You can still proceed and call HTTP.read if the content length is "-1", it just means that the server can't provide the byte count.

If this command fails with the error code set to "6" (Could not create an HTTP request handle), the resource you are trying to access does not exist. The most common cause is using the wrong protocol to access the resource. "HTTP" and "HTTPS" are not interchangeable.

                

Examples:

var return_obj = ssCore.HTTP.getContentLength();

ssDebug.trace(return_obj.result);