accumulate([updateCallback])

Read the whole stream and call a callback with the complete content.

Returns : A Promise of the full content.

Since: v3.0.0

Arguments

name type description
updateCallback function the function called every time the stream updates. This function is optional.

The update callback function takes 1 parameter: the metadata (see the on method).

Example

zip
.generateInternalStream({type:"uint8array"})
.accumulate(function updateCallback(metadata) {
    // metadata contains for example currentFile and percent, see the generateInternalStream doc.
}).then(function (data) {
    // data contains here the complete zip file as a uint8array (the type asked in generateInternalStream)
});