MCPcopy Create free account
hub / github.com/microsoft/SandDance / Buffer

Function Buffer

docs/app/js/sanddance-app.js:112929–112936  ·  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

112927 *
112928 * The `Uint8Array` prototype remains unmodified.
112929 */ function Buffer(arg, encodingOrOffset, length) {
112930 // Common case.
112931 if (typeof arg === "number") {
112932 if (typeof encodingOrOffset === "string") throw new TypeError('The "string" argument must be of type string. Received type number');
112933 return allocUnsafe(arg);
112934 }
112935 return from(arg, encodingOrOffset, length);
112936}
112937Buffer.poolSize = 8192 // not used by this implementation
112938;
112939function from(value, encodingOrOffset, length) {

Callers

nothing calls this directly

Calls 2

allocUnsafeFunction · 0.70
fromFunction · 0.70

Tested by

no test coverage detected