Global

Members

crs

Source:

Inflate

ungzip(data[, options]) -> Uint8Array|Array|String - data (Uint8Array|Array|String): input data to decompress. - options (Object): zlib inflate options. Just shortcut to [[inflate]], because it autodetects format by header.content. Done for convenience.
Source:

MAX_VALUE_16BITS

Deprecated:
  • This value will be removed in a future version without replacement.
Source:

MAX_VALUE_32BITS

Deprecated:
  • This value will be removed in a future version without replacement.
Source:

style

Style of this feature. Every feature should have a style. If there is no Style, null is returned.
Source:

Methods

arrayBuffer2Blob()

Deprecated:
  • This function will be removed in a future version without replacement.
Source:

catch(onRejection) → {Promise}

`catch` is simply sugar for `then(undefined, onRejection)` which makes it the same as the catch block of a try/catch statement. ```js function findAuthor(){ throw new Error('couldn't find that author'); } // synchronous try { findAuthor(); } catch(reason) { // something went wrong } // async with promises findAuthor().catch(function(reason){ // something went wrong }); ```
Parameters:
Name Type Description
onRejection function Useful for tooling.
Source:
Returns:
Type
Promise

checkSupport()

Deprecated:
  • This function will be removed in a future version without replacement.
Source:

checkSupport(type)

Throw an exception if the type is not supported.
Parameters:
Name Type Description
type String the type to check.
Source:
Throws:
an Error if the browser doesn't support the requested type.
Type
Error

findCompression()

Deprecated:
  • This function will be removed in a future version without replacement.
Source:

findCompression(compressionMethod) → {Object|null}

Find a compression registered in JSZip.
Parameters:
Name Type Description
compressionMethod string the method magic to find.
Source:
Returns:
the JSZip compression object, null if none found.
Type
Object | null

getTypeOf(input) → {String}

Return the type of the input. The type will be in a format valid for JSZip.utils.transformTo : string, array, uint8array, arraybuffer.
Parameters:
Name Type Description
input Object the input to identify.
Source:
Returns:
the (lowercase) type of the input.
Type
String

getTypeOf()

Deprecated:
  • This function will be removed in a future version without replacement.
Source:

isRegExp(object) → {Boolean}

Cross-window, cross-Node-context regular expression detection
Parameters:
Name Type Description
object Object Anything
Source:
Returns:
true if the object is a regular expression, false otherwise
Type
Boolean

isRegExp()

Deprecated:
  • This function will be removed in a future version without replacement.
Source:

pretty()

Deprecated:
  • This function will be removed in a future version without replacement.
Source:

pretty(str) → {string}

Prettify a string read as binary.
Parameters:
Name Type Description
str string the string to prettify.
Source:
Returns:
a pretty string.
Type
string

string2binary(str) → {String}

Convert a string to a "binary string" : a string containing only char codes between 0 and 255.
Parameters:
Name Type Description
str string the string to transform.
Source:
Returns:
the binary string.
Type
String

string2binary()

Deprecated:
  • This function will be removed in a future version without replacement.
Source:

string2Blob()

Deprecated:
  • This function will be removed in a future version without replacement.
Source:

string2Uint8Array()

Deprecated:
  • This function will be removed in a future version without replacement.
Source:

then(onFulfilled, onRejected) → {Promise}

The primary way of interacting with a promise is through its `then` method, which registers callbacks to receive either a promise's eventual value or the reason why the promise cannot be fulfilled. ```js findUser().then(function(user){ // user is available }, function(reason){ // user is unavailable, and you are given the reason why }); ``` Chaining -------- The return value of `then` is itself a promise. This second, 'downstream' promise is resolved with the return value of the first promise's fulfillment or rejection handler, or rejected if the handler throws an exception. ```js findUser().then(function (user) { return user.name; }, function (reason) { return 'default name'; }).then(function (userName) { // If `findUser` fulfilled, `userName` will be the user's name, otherwise it // will be `'default name'` }); findUser().then(function (user) { throw new Error('Found user, but still unhappy'); }, function (reason) { throw new Error('`findUser` rejected and we're unhappy'); }).then(function (value) { // never reached }, function (reason) { // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. }); ``` If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. ```js findUser().then(function (user) { throw new PedagogicalException('Upstream error'); }).then(function (value) { // never reached }).then(function (value) { // never reached }, function (reason) { // The `PedgagocialException` is propagated all the way down to here }); ``` Assimilation ------------ Sometimes the value you want to propagate to a downstream promise can only be retrieved asynchronously. This can be achieved by returning a promise in the fulfillment or rejection handler. The downstream promise will then be pending until the returned promise is settled. This is called *assimilation*. ```js findUser().then(function (user) { return findCommentsByAuthor(user); }).then(function (comments) { // The user's comments are now available }); ``` If the assimliated promise rejects, then the downstream promise will also reject. ```js findUser().then(function (user) { return findCommentsByAuthor(user); }).then(function (comments) { // If `findCommentsByAuthor` fulfills, we'll have the value here }, function (reason) { // If `findCommentsByAuthor` rejects, we'll have the reason here }); ``` Simple Example -------------- Synchronous Example ```javascript var result; try { result = findResult(); // success } catch(reason) { // failure } ``` Errback Example ```js findResult(function(result, err){ if (err) { // failure } else { // success } }); ``` Promise Example; ```javascript findResult().then(function(result){ // success }, function(reason){ // failure }); ``` Advanced Example -------------- Synchronous Example ```javascript var author, books; try { author = findAuthor(); books = findBooksByAuthor(author); // success } catch(reason) { // failure } ``` Errback Example ```js function foundBooks(books) { } function failure(reason) { } findAuthor(function(author, err){ if (err) { failure(err); // failure } else { try { findBoooksByAuthor(author, function(books, err) { if (err) { failure(err); } else { try { foundBooks(books); } catch(reason) { failure(reason); } } }); } catch(error) { failure(err); } // success } }); ``` Promise Example; ```javascript findAuthor(). then(findBooksByAuthor). then(function(books){ // found books }).catch(function(reason){ // something went wrong }); ```
Parameters:
Name Type Description
onFulfilled function
onRejected function Useful for tooling.
Source:
Returns:
Type
Promise

transformTo()

Deprecated:
  • This function will be removed in a future version without replacement.
Source:

transformTo(outputType, input)

Transform an input into any type. The supported output type are : string, array, uint8array, arraybuffer, nodebuffer. If no output type is specified, the unmodified input will be returned.
Parameters:
Name Type Description
outputType String the output type.
input String | Array | ArrayBuffer | Uint8Array | Buffer the input to convert.
Source:
Throws:
an Error if the browser doesn't support the requested output type.
Type
Error

uint8Array2String()

Deprecated:
  • This function will be removed in a future version without replacement.
Source:

utf8decode(buf) → {String}

Transform a bytes array (or a representation) representing an UTF-8 encoded string into a javascript string.
Parameters:
Name Type Description
buf Array | Uint8Array | Buffer the data de decode
Source:
Returns:
the decoded string.
Type
String

utf8encode(str) → {Array|Uint8Array|Buffer}

Transform a javascript string into an array (typed if possible) of bytes, UTF-8 encoded.
Parameters:
Name Type Description
str String the string to encode
Source:
Returns:
the UTF-8 encoded string.
Type
Array | Uint8Array | Buffer