MCPcopy Create free account
hub / github.com/UI5/webcomponents / Buffer

Function Buffer

packages/main/test/pages/diffable-html.js:217–228  ·  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

(arg, encodingOrOffset, length)

Source from the content-addressed store, hash-verified

215 */
216
217 function Buffer (arg, encodingOrOffset, length) {
218 // Common case.
219 if (typeof arg === 'number') {
220 if (typeof encodingOrOffset === 'string') {
221 throw new Error(
222 'If encoding is specified then the first argument must be a string'
223 )
224 }
225 return allocUnsafe(arg)
226 }
227 return from(arg, encodingOrOffset, length)
228 }
229
230 // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
231 if (typeof Symbol !== 'undefined' && Symbol.species &&

Callers 2

SafeBufferFunction · 0.85
diffable-html.jsFile · 0.85

Calls 2

allocUnsafeFunction · 0.85
fromFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…