IPWorks Cloud 2020 Node.js Edition

Questions / Feedback?

Progress Event

Fires during an upload or download to indicate transfer progress.

Syntax

linode.on('Progress', [callback])

Callback

The 'callback' is called when the 'Progress' event is emited.

function(e){ }

The argument 'e' has the following properties:

e.direction
e.bytesTransferred
e.totalBytes
e.percentDone

Remarks

This event fires during an upload or download to indicate the progress of the transfer of the entire request. By default, this event will fire each time PercentDone increases by one percent; the ProgressStep configuration setting can be used to alter this behavior.

Direction indicates whether the transfer is an upload (0) or a download (1).

BytesTransferred reflects the number of bytes that have been transferred so far, or 0 if the transfer is starting (however, see note below).

TotalBytes reflects the total number of bytes that are to be transferred, or -1 if the total is unknown. This amount includes the size of everything in the request like HTTP headers.

PercentDone reflects the overall progress of the transfer, or -1 if the progress cannot be calculated.

Note: By default, the class tracks transfer progress absolutely. If a transfer is interrupted and later resumed, the values reported by this event upon and after resumption will account for the data that was transferred before the interruption.

For example, if 10MB of data was successfully transferred before the interruption, then this event will fire with a BytesTransferred value of 10485760 (10MB) when the transfer is first resumed, and then continue to fire with successively greater values as usual.

This behavior can be changed by disabling the ProgressAbsolute configuration setting, in which case the class will treat resumed transfers as "new" transfers. In this case, the BytesTransferred parameter will always be 0 the first time this event fires, regardless of whether the transfer is new or being resumed.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks Cloud 2020 Node.js Edition - Version 20.0 [Build 8265]