MCPcopy Create free account
hub / github.com/TruthHun/BookStack / dataToString

Function dataToString

static/word2md/mammoth.browser.js:12719–12742  ·  view source on GitHub ↗
(asUTF8)

Source from the content-addressed store, hash-verified

12717 * @return {String} the string representing this._data.
12718 */
12719var dataToString = function(asUTF8) {
12720 var result = getRawData(this);
12721 if (result === null || typeof result === "undefined") {
12722 return "";
12723 }
12724 // if the data is a base64 string, we decode it before checking the encoding !
12725 if (this.options.base64) {
12726 result = base64.decode(result);
12727 }
12728 if (asUTF8 && this.options.binary) {
12729 // JSZip.prototype.utf8decode supports arrays as input
12730 // skip to array => string step, utf8decode will do it.
12731 result = out.utf8decode(result);
12732 }
12733 else {
12734 // no utf8 transformation, do the array => string step.
12735 result = utils.transformTo("string", result);
12736 }
12737
12738 if (!asUTF8 && !this.options.binary) {
12739 result = utils.transformTo("string", out.utf8encode(result));
12740 }
12741 return result;
12742};
12743/**
12744 * A simple object representing a file in the zip file.
12745 * @constructor

Callers

nothing calls this directly

Calls 1

getRawDataFunction · 0.70

Tested by

no test coverage detected