async(type[, onUpdate])

Description : Return a Promise of the content in the asked type.

Arguments

name type description
type String the type of the result : string (or text, its alias), binarystring, base64, array, uint8array, arraybuffer, nodebuffer.
onUpdate Function an optional function called on each internal update with the metadata.

Metadata : the metadata are :

name type description
percent number the percent of completion (a double between 0 and 100)

Returns : A Promise of the content.

Throws : Nothing.

Example

zip
.file("my_text.txt")
.async("string")
.then(function success(content) {
    // use the content
}, function error(e) {
    // handle the error
});
zip
.file("my_text.txt")
.async("string", function (meta) {
    console.log("Generating the content, we are at " + meta.percent.toFixed(2) + " %");
})
.then(...);