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

Function getRawData

static/word2md/mammoth.browser.js:12673–12691  ·  view source on GitHub ↗
(file)

Source from the content-addressed store, hash-verified

12671 * @return {String|ArrayBuffer|Uint8Array|Buffer} the data.
12672 */
12673var getRawData = function(file) {
12674 if (file._data instanceof CompressedObject) {
12675 file._data = file._data.getContent();
12676 file.options.binary = true;
12677 file.options.base64 = false;
12678
12679 if (utils.getTypeOf(file._data) === "uint8array") {
12680 var copy = file._data;
12681 // when reading an arraybuffer, the CompressedObject mechanism will keep it and subarray() a Uint8Array.
12682 // if we request a file in the same format, we might get the same Uint8Array or its ArrayBuffer (the original zip file).
12683 file._data = new Uint8Array(copy.length);
12684 // with an empty Uint8Array, Opera fails with a "Offset larger than array size"
12685 if (copy.length !== 0) {
12686 file._data.set(copy, 0);
12687 }
12688 }
12689 }
12690 return file._data;
12691};
12692
12693/**
12694 * Returns the data of a ZipObject in a binary form. If the content is an unicode string, encode it.

Callers 2

getBinaryDataFunction · 0.70
dataToStringFunction · 0.70

Calls 1

setMethod · 0.45

Tested by

no test coverage detected