Lines Matching defs:Buffer
132 FastBuffer.prototype.constructor = Buffer;
133 Buffer.prototype = FastBuffer.prototype;
134 addBufferPrototypeMethods(Buffer.prototype);
151 Buffer.poolSize = 8 * 1024;
159 poolSize = Buffer.poolSize;
176 const bufferWarning = 'Buffer() is deprecated due to security and usability ' +
177 'issues. Please use the Buffer.alloc(), ' +
178 'Buffer.allocUnsafe(), or Buffer.from() methods instead.';
210 throw new ERR_INVALID_ARG_TYPE('source', ['Buffer', 'Uint8Array'], source);
212 throw new ERR_INVALID_ARG_TYPE('target', ['Buffer', 'Uint8Array'], target);
262 * The Buffer() constructor is deprecated in documentation and should not be
264 * factory APIs: Buffer.from(), Buffer.allocUnsafe() or Buffer.alloc() based on
266 * to which the Buffer constructor is used in the ecosystem currently -- a
268 * likely that the Buffer constructors would ever actually be removed.
271 function Buffer(arg, encodingOrOffset, length) {
278 return Buffer.alloc(arg);
280 return Buffer.from(arg, encodingOrOffset, length);
283 ObjectDefineProperty(Buffer, SymbolSpecies, {
291 * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
293 * Buffer.from(str[, encoding])
294 * Buffer.from(array)
295 * Buffer.from(buffer)
296 * Buffer.from(arrayBuffer[, byteOffset[, length]])
298 Buffer.from = function from(value, encodingOrOffset, length) {
327 ['string', 'Buffer', 'ArrayBuffer', 'Array', 'Array-like Object'],
333 * Creates the Buffer as a copy of the underlying ArrayBuffer of the view
338 * @returns {Buffer}
340 Buffer.copyBytesFrom = function copyBytesFrom(view, offset, length) {
347 return Buffer.alloc(0);
353 if (offset >= viewLength) return Buffer.alloc(0);
375 // Buffer() constructor. Must use arrow function syntax to avoid automatically
386 Buffer.of = of;
388 ObjectSetPrototypeOf(Buffer, Uint8Array);
401 * Creates a new filled Buffer instance.
404 Buffer.alloc = function alloc(size, fill, encoding) {
414 * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer
417 Buffer.allocUnsafe = function allocUnsafe(size) {
424 * Buffer instance that is not allocated off the pre-initialized pool.
427 Buffer.allocUnsafeSlow = function allocUnsafeSlow(size) {
446 if (size < (Buffer.poolSize >>> 1)) {
460 if (length >= (Buffer.poolSize >>> 1))
527 if (obj.length < (Buffer.poolSize >>> 1)) {
547 if (obj.type === 'Buffer' && ArrayIsArray(obj.data)) {
554 Buffer.isBuffer = function isBuffer(b) {
555 return b instanceof Buffer;
558 Buffer.compare = function compare(buf1, buf2) {
560 throw new ERR_INVALID_ARG_TYPE('buf1', ['Buffer', 'Uint8Array'], buf1);
564 throw new ERR_INVALID_ARG_TYPE('buf2', ['Buffer', 'Uint8Array'], buf2);
574 Buffer.isEncoding = function isEncoding(encoding) {
578 Buffer[kIsEncodingSymbol] = Buffer.isEncoding;
580 Buffer.concat = function concat(list, length) {
597 const buffer = Buffer.allocUnsafe(length);
605 `list[${i}]`, ['Buffer', 'Uint8Array'], list[i]);
780 'string', ['string', 'Buffer', 'ArrayBuffer'], string,
797 Buffer.byteLength = byteLength;
800 ObjectDefineProperty(Buffer.prototype, 'parent', {
804 if (!(this instanceof Buffer))
809 ObjectDefineProperty(Buffer.prototype, 'offset', {
813 if (!(this instanceof Buffer))
819 Buffer.prototype.copy =
828 Buffer.prototype.toString = function toString(encoding, start, end) {
860 Buffer.prototype.equals = function equals(otherBuffer) {
863 'otherBuffer', ['Buffer', 'Uint8Array'], otherBuffer);
877 Buffer.prototype[customInspectSymbol] = function inspect(recurseTimes, ctx) {
909 Buffer.prototype.inspect = Buffer.prototype[customInspectSymbol];
911 Buffer.prototype.compare = function compare(target,
917 throw new ERR_INVALID_ARG_TYPE('target', ['Buffer', 'Uint8Array'], target);
955 // - buffer - a Buffer to search
956 // - val - a string, Buffer, or number
1001 'value', ['number', 'string', 'Buffer', 'Uint8Array'], val,
1005 Buffer.prototype.indexOf = function indexOf(val, byteOffset, encoding) {
1009 Buffer.prototype.lastIndexOf = function lastIndexOf(val, byteOffset, encoding) {
1013 Buffer.prototype.includes = function includes(val, byteOffset, encoding) {
1021 Buffer.prototype.fill = function fill(value, offset, end, encoding) {
1096 Buffer.prototype.write = function write(string, offset, length, encoding) {
1097 // Buffer#write(string);
1101 // Buffer#write(string, encoding)
1107 // Buffer#write(string, offset[, length][, encoding])
1134 Buffer.prototype.toJSON = function toJSON() {
1139 return { type: 'Buffer', data };
1141 return { type: 'Buffer', data: [] };
1161 Buffer.prototype.subarray = function subarray(start, end) {
1169 Buffer.prototype.slice = function slice(start, end) {
1179 Buffer.prototype.swap16 = function swap16() {
1180 // For Buffer.length < 128, it's generally faster to
1194 Buffer.prototype.swap32 = function swap32() {
1195 // For Buffer.length < 192, it's generally faster to
1211 Buffer.prototype.swap64 = function swap64() {
1212 // For Buffer.length < 192, it's generally faster to
1230 Buffer.prototype.toLocaleString = Buffer.prototype.toString;
1239 // Transcodes the Buffer from one encoding to another, returning a new
1240 // Buffer instance.
1244 ['Buffer', 'Uint8Array'], source);
1246 if (source.length === 0) return Buffer.alloc(0);
1256 `Unable to transcode Buffer [${code}]`,
1275 const buf = Buffer.from(input, 'latin1');
1357 return Buffer.from(input, 'base64').toString('latin1');
1365 throw new ERR_INVALID_ARG_TYPE('input', ['TypedArray', 'Buffer'], input);
1373 throw new ERR_INVALID_ARG_TYPE('input', ['ArrayBuffer', 'Buffer', 'TypedArray'], input);
1377 Buffer,