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

Function createBuffer

static/word2md/mammoth.browser.js:9760–9777  ·  view source on GitHub ↗
(that, length)

Source from the content-addressed store, hash-verified

9758}
9759
9760function createBuffer (that, length) {
9761 if (kMaxLength() < length) {
9762 throw new RangeError('Invalid typed array length')
9763 }
9764 if (Buffer.TYPED_ARRAY_SUPPORT) {
9765 // Return an augmented `Uint8Array` instance, for best performance
9766 that = new Uint8Array(length)
9767 that.__proto__ = Buffer.prototype
9768 } else {
9769 // Fallback: Return an object instance of the Buffer class
9770 if (that === null) {
9771 that = new Buffer(length)
9772 }
9773 that.length = length
9774 }
9775
9776 return that
9777}
9778
9779/**
9780 * The Buffer constructor returns instances of `Uint8Array` that have their

Callers 5

allocFunction · 0.70
allocUnsafeFunction · 0.70
fromStringFunction · 0.70
fromArrayLikeFunction · 0.70
fromObjectFunction · 0.70

Calls 1

kMaxLengthFunction · 0.70

Tested by

no test coverage detected