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

Function Buffer

static/word2md/mammoth.browser.js:9789–9804  ·  view source on GitHub ↗

* The Buffer constructor returns instances of `Uint8Array` that have their * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of * `Uint8Array`, so the returned instances will have all the node `Buffer` methods * and the `Uint8Array` methods. Square bracket notation wo

(arg, encodingOrOffset, length)

Source from the content-addressed store, hash-verified

9787 */
9788
9789function Buffer (arg, encodingOrOffset, length) {
9790 if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
9791 return new Buffer(arg, encodingOrOffset, length)
9792 }
9793
9794 // Common case.
9795 if (typeof arg === 'number') {
9796 if (typeof encodingOrOffset === 'string') {
9797 throw new Error(
9798 'If encoding is specified then the first argument must be a string'
9799 )
9800 }
9801 return allocUnsafe(this, arg)
9802 }
9803 return from(this, arg, encodingOrOffset, length)
9804}
9805
9806Buffer.poolSize = 8192 // not used by this implementation
9807

Callers

nothing calls this directly

Calls 2

allocUnsafeFunction · 0.70
fromFunction · 0.70

Tested by

no test coverage detected