Buffer

@JSImport("buffer", "Buffer") @native @JSType class Buffer extends Buffer

Raw data is stored in instances of the Buffer class. A Buffer is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap. A Buffer cannot be resized. Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'binary'(deprecated)|'hex'

Companion
object
class Buffer
trait _PathLike
trait _KeyLike
trait NumberDictionary[Double]
trait StObject
class Object
trait Any
class Object
trait Matchable
class Any
class Buffer

Value members

Constructors

def this(arrayBuffer: SharedArrayBuffer)
def this(arrayBuffer: ArrayBuffer)

Produces a Buffer backed by the same allocated memory as the given {ArrayBuffer}/{SharedArrayBuffer}.

Produces a Buffer backed by the same allocated memory as the given {ArrayBuffer}/{SharedArrayBuffer}.

Value Params
arrayBuffer

The ArrayBuffer with which to share memory.

def this(array: Array[Any])

Allocates a new buffer containing the given {array} of octets.

Allocates a new buffer containing the given {array} of octets.

Value Params
array

The octets to store.

def this(array: Uint8Array)

Allocates a new buffer containing the given {array} of octets.

Allocates a new buffer containing the given {array} of octets.

Value Params
array

The octets to store.

def this(buffer: Buffer)

Copies the passed {buffer} data onto a new {Buffer} instance.

Copies the passed {buffer} data onto a new {Buffer} instance.

Value Params
buffer

The buffer to copy.

def this(size: Double)

Allocates a new buffer of {size} octets.

Allocates a new buffer of {size} octets.

Value Params
size

count of octets to allocate.

def this(str: String)

Allocates a new buffer containing the given {str}.

Allocates a new buffer containing the given {str}.

Value Params
encoding

encoding to use, optional. Default is 'utf8'

str

String to store in buffer.

def this(str: String, encoding: BufferEncoding)

Inherited methods

def compare(otherBuffer: Uint8Array, targetStart: Unit, targetEnd: Unit, sourceStart: Unit, sourceEnd: Double): Double
Inherited from
Buffer
def compare(otherBuffer: Uint8Array, targetStart: Unit, targetEnd: Unit, sourceStart: Double, sourceEnd: Double): Double
Inherited from
Buffer
def compare(otherBuffer: Uint8Array, targetStart: Unit, targetEnd: Unit, sourceStart: Double): Double
Inherited from
Buffer
def compare(otherBuffer: Uint8Array, targetStart: Unit, targetEnd: Double, sourceStart: Unit, sourceEnd: Double): Double
Inherited from
Buffer
def compare(otherBuffer: Uint8Array, targetStart: Unit, targetEnd: Double, sourceStart: Double, sourceEnd: Double): Double
Inherited from
Buffer
def compare(otherBuffer: Uint8Array, targetStart: Unit, targetEnd: Double, sourceStart: Double): Double
Inherited from
Buffer
def compare(otherBuffer: Uint8Array, targetStart: Unit, targetEnd: Double): Double
Inherited from
Buffer
def compare(otherBuffer: Uint8Array, targetStart: Double, targetEnd: Unit, sourceStart: Unit, sourceEnd: Double): Double
Inherited from
Buffer
def compare(otherBuffer: Uint8Array, targetStart: Double, targetEnd: Unit, sourceStart: Double, sourceEnd: Double): Double
Inherited from
Buffer
def compare(otherBuffer: Uint8Array, targetStart: Double, targetEnd: Unit, sourceStart: Double): Double
Inherited from
Buffer
def compare(otherBuffer: Uint8Array, targetStart: Double, targetEnd: Double, sourceStart: Unit, sourceEnd: Double): Double
Inherited from
Buffer
def compare(otherBuffer: Uint8Array, targetStart: Double, targetEnd: Double, sourceStart: Double, sourceEnd: Double): Double
Inherited from
Buffer
def compare(otherBuffer: Uint8Array, targetStart: Double, targetEnd: Double, sourceStart: Double): Double
Inherited from
Buffer
def compare(otherBuffer: Uint8Array, targetStart: Double, targetEnd: Double): Double
Inherited from
Buffer
def compare(otherBuffer: Uint8Array, targetStart: Double): Double
Inherited from
Buffer
def compare(otherBuffer: Uint8Array): Double
Inherited from
Buffer
def copy(targetBuffer: Uint8Array, targetStart: Unit, sourceStart: Unit, sourceEnd: Double): Double
Inherited from
Buffer
def copy(targetBuffer: Uint8Array, targetStart: Unit, sourceStart: Double, sourceEnd: Double): Double
Inherited from
Buffer
def copy(targetBuffer: Uint8Array, targetStart: Unit, sourceStart: Double): Double
Inherited from
Buffer
def copy(targetBuffer: Uint8Array, targetStart: Double, sourceStart: Unit, sourceEnd: Double): Double
Inherited from
Buffer
def copy(targetBuffer: Uint8Array, targetStart: Double, sourceStart: Double, sourceEnd: Double): Double
Inherited from
Buffer
def copy(targetBuffer: Uint8Array, targetStart: Double, sourceStart: Double): Double
Inherited from
Buffer
def copy(targetBuffer: Uint8Array, targetStart: Double): Double
Inherited from
Buffer
def copy(targetBuffer: Uint8Array): Double
Inherited from
Buffer
def copyWithin(target: Double, start: Double, end: Double): Buffer
Inherited from
Uint8Array
def copyWithin(target: Double, start: Double): Buffer

Returns the this object after copying a section of the array identified by start and end to the same array starting at position target

Returns the this object after copying a section of the array identified by start and end to the same array starting at position target

Value Params
end

If not specified, length of the this object is used as its default value.

start

If start is negative, it is treated as length+start. If end is negative, it is treated as length+end.

target

If target is negative, it is treated as length+target where length is the length of the array.

Inherited from
Uint8Array
def entries(): IterableIterator[Tuple2[Double, Double]]

Returns an array of key, value pairs for every entry in the array

Returns an array of key, value pairs for every entry in the array

Inherited from
Uint8Array
def equals(otherBuffer: Uint8Array): Boolean
Inherited from
Buffer
def every(predicate: Function3[Double, Double, Buffer, Any], thisArg: Any): Boolean
Inherited from
Uint8Array
def every(predicate: Function3[Double, Double, Buffer, Any]): Boolean

Determines whether all the members of an array satisfy the specified test.

Determines whether all the members of an array satisfy the specified test.

Value Params
predicate

A function that accepts up to three arguments. The every method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value false, or until the end of the array.

thisArg

An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

Inherited from
Uint8Array
def fill(value: Double, offset: Unit, end: Unit, encoding: BufferEncoding): Buffer
Inherited from
Buffer
def fill(value: Double, offset: Unit, end: Double, encoding: BufferEncoding): Buffer
Inherited from
Buffer
def fill(value: Double, offset: Double, end: Unit, encoding: BufferEncoding): Buffer
Inherited from
Buffer
def fill(value: Double, offset: Double, end: Double, encoding: BufferEncoding): Buffer
Inherited from
Buffer
def fill(value: Uint8Array, offset: Unit, end: Unit, encoding: BufferEncoding): Buffer
Inherited from
Buffer
def fill(value: Uint8Array, offset: Unit, end: Double, encoding: BufferEncoding): Buffer
Inherited from
Buffer
def fill(value: Uint8Array, offset: Unit, end: Double): Buffer
Inherited from
Buffer
def fill(value: Uint8Array, offset: Double, end: Unit, encoding: BufferEncoding): Buffer
Inherited from
Buffer
def fill(value: Uint8Array, offset: Double, end: Double, encoding: BufferEncoding): Buffer
Inherited from
Buffer
def fill(value: Uint8Array, offset: Double, end: Double): Buffer
Inherited from
Buffer
def fill(value: Uint8Array, offset: Double): Buffer
Inherited from
Buffer
def fill(value: Uint8Array): Buffer
Inherited from
Buffer
def fill(value: String, offset: Unit, end: Unit, encoding: BufferEncoding): Buffer
Inherited from
Buffer
def fill(value: String, offset: Unit, end: Double, encoding: BufferEncoding): Buffer
Inherited from
Buffer
def fill(value: String, offset: Unit, end: Double): Buffer
Inherited from
Buffer
def fill(value: String, offset: Double, end: Unit, encoding: BufferEncoding): Buffer
Inherited from
Buffer
def fill(value: String, offset: Double, end: Double, encoding: BufferEncoding): Buffer
Inherited from
Buffer
def fill(value: String, offset: Double, end: Double): Buffer
Inherited from
Buffer
def fill(value: String, offset: Double): Buffer
Inherited from
Buffer
def fill(value: String): Buffer
Inherited from
Buffer
def fill(value: Double, start: Unit, end: Double): Buffer
Inherited from
Uint8Array
def fill(value: Double, start: Double, end: Double): Buffer
Inherited from
Uint8Array
def fill(value: Double, start: Double): Buffer
Inherited from
Uint8Array
def fill(value: Double): Buffer

Returns the this object after filling the section identified by start and end with value

Returns the this object after filling the section identified by start and end with value

Value Params
end

index to stop filling the array at. If end is negative, it is treated as length+end.

start

index to start filling the array at. If start is negative, it is treated as length+start where length is the length of the array.

value

value to fill array section with

Inherited from
Uint8Array
def filter(predicate: Function3[Double, Double, Buffer, Any], thisArg: Any): Uint8Array
Inherited from
Uint8Array
def filter(predicate: Function3[Double, Double, Buffer, Any]): Uint8Array

Returns the elements of an array that meet the condition specified in a callback function.

Returns the elements of an array that meet the condition specified in a callback function.

Value Params
predicate

A function that accepts up to three arguments. The filter method calls the predicate function one time for each element in the array.

thisArg

An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

Inherited from
Uint8Array
def find(predicate: Function3[Double, Double, Buffer, Boolean], thisArg: Any): UndefOr[Double]
Inherited from
Uint8Array
def find(predicate: Function3[Double, Double, Buffer, Boolean]): UndefOr[Double]

Returns the value of the first element in the array where predicate is true, and undefined otherwise.

Returns the value of the first element in the array where predicate is true, and undefined otherwise.

Value Params
predicate

find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, find immediately returns that element value. Otherwise, find returns undefined.

thisArg

If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

Inherited from
Uint8Array
def findIndex(predicate: Function3[Double, Double, Buffer, Boolean], thisArg: Any): Double
Inherited from
Uint8Array
def findIndex(predicate: Function3[Double, Double, Buffer, Boolean]): Double

Returns the index of the first element in the array where predicate is true, and -1 otherwise.

Returns the index of the first element in the array where predicate is true, and -1 otherwise.

Value Params
predicate

find calls predicate once for each element of the array, in ascending order, until it finds one where predicate returns true. If such an element is found, findIndex immediately returns that element index. Otherwise, findIndex returns -1.

thisArg

If provided, it will be used as the this value for each invocation of predicate. If it is not provided, undefined is used instead.

Inherited from
Uint8Array
def forEach(callbackfn: Function3[Double, Double, Buffer, Unit], thisArg: Any): Unit
Inherited from
Uint8Array
def forEach(callbackfn: Function3[Double, Double, Buffer, Unit]): Unit

Performs the specified action for each element in an array.

Performs the specified action for each element in an array.

Value Params
callbackfn

A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.

thisArg

An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

Inherited from
Uint8Array
def hasOwnProperty(v: String): Boolean
Inherited from
Object
def includes(value: Double, byteOffset: Unit, encoding: BufferEncoding): Boolean
Inherited from
Buffer
def includes(value: Double, byteOffset: Double, encoding: BufferEncoding): Boolean
Inherited from
Buffer
def includes(value: String, byteOffset: Unit, encoding: BufferEncoding): Boolean
Inherited from
Buffer
def includes(value: String, byteOffset: Double, encoding: BufferEncoding): Boolean
Inherited from
Buffer
def includes(value: String, byteOffset: Double): Boolean
Inherited from
Buffer
def includes(value: String): Boolean
Inherited from
Buffer
def includes(value: Buffer, byteOffset: Unit, encoding: BufferEncoding): Boolean
Inherited from
Buffer
def includes(value: Buffer, byteOffset: Double, encoding: BufferEncoding): Boolean
Inherited from
Buffer
def includes(value: Buffer, byteOffset: Double): Boolean
Inherited from
Buffer
def includes(value: Buffer): Boolean
Inherited from
Buffer
def includes(searchElement: Double, fromIndex: Double): Boolean
Inherited from
Uint8Array
def includes(searchElement: Double): Boolean

Determines whether an array includes a certain element, returning true or false as appropriate.

Determines whether an array includes a certain element, returning true or false as appropriate.

Value Params
fromIndex

The position in this array at which to begin searching for searchElement.

searchElement

The element to search for.

Inherited from
Uint8Array
def indexOf(value: Double, byteOffset: Unit, encoding: BufferEncoding): Double
Inherited from
Buffer
def indexOf(value: Double, byteOffset: Double, encoding: BufferEncoding): Double
Inherited from
Buffer
def indexOf(value: Uint8Array, byteOffset: Unit, encoding: BufferEncoding): Double
Inherited from
Buffer
def indexOf(value: Uint8Array, byteOffset: Double, encoding: BufferEncoding): Double
Inherited from
Buffer
def indexOf(value: Uint8Array, byteOffset: Double): Double
Inherited from
Buffer
def indexOf(value: Uint8Array): Double
Inherited from
Buffer
def indexOf(value: String, byteOffset: Unit, encoding: BufferEncoding): Double
Inherited from
Buffer
def indexOf(value: String, byteOffset: Double, encoding: BufferEncoding): Double
Inherited from
Buffer
def indexOf(value: String, byteOffset: Double): Double
Inherited from
Buffer
def indexOf(value: String): Double
Inherited from
Buffer
def indexOf(searchElement: Double, fromIndex: Double): Double
Inherited from
Uint8Array
def indexOf(searchElement: Double): Double

Returns the index of the first occurrence of a value in an array.

Returns the index of the first occurrence of a value in an array.

Value Params
fromIndex

The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.

searchElement

The value to locate in the array.

Inherited from
Uint8Array
def isPrototypeOf(v: Object): Boolean
Inherited from
Object
def join(separator: String): String
Inherited from
Uint8Array
def join(): String

Adds all the elements of an array separated by the specified separator string.

Adds all the elements of an array separated by the specified separator string.

Value Params
separator

A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.

Inherited from
Uint8Array
def keys(): IterableIterator[Double]

Returns an list of keys in the array

Returns an list of keys in the array

Inherited from
Uint8Array
def lastIndexOf(value: Double, byteOffset: Unit, encoding: BufferEncoding): Double
Inherited from
Buffer
def lastIndexOf(value: Double, byteOffset: Double, encoding: BufferEncoding): Double
Inherited from
Buffer
def lastIndexOf(value: Uint8Array, byteOffset: Unit, encoding: BufferEncoding): Double
Inherited from
Buffer
def lastIndexOf(value: Uint8Array, byteOffset: Double, encoding: BufferEncoding): Double
Inherited from
Buffer
def lastIndexOf(value: Uint8Array, byteOffset: Double): Double
Inherited from
Buffer
def lastIndexOf(value: Uint8Array): Double
Inherited from
Buffer
def lastIndexOf(value: String, byteOffset: Unit, encoding: BufferEncoding): Double
Inherited from
Buffer
def lastIndexOf(value: String, byteOffset: Double, encoding: BufferEncoding): Double
Inherited from
Buffer
def lastIndexOf(value: String, byteOffset: Double): Double
Inherited from
Buffer
def lastIndexOf(value: String): Double
Inherited from
Buffer
def lastIndexOf(searchElement: Double, fromIndex: Double): Double
Inherited from
Uint8Array
def lastIndexOf(searchElement: Double): Double

Returns the index of the last occurrence of a value in an array.

Returns the index of the last occurrence of a value in an array.

Value Params
fromIndex

The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.

searchElement

The value to locate in the array.

Inherited from
Uint8Array
def map(callbackfn: Function3[Double, Double, Buffer, Double], thisArg: Any): Uint8Array
Inherited from
Uint8Array
def map(callbackfn: Function3[Double, Double, Buffer, Double]): Uint8Array

Calls a defined callback function on each element of an array, and returns an array that contains the results.

Calls a defined callback function on each element of an array, and returns an array that contains the results.

Value Params
callbackfn

A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.

thisArg

An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.

Inherited from
Uint8Array
def propertyIsEnumerable(v: String): Boolean
Inherited from
Object
def readBigInt64BE(offset: Double): BigInt
Inherited from
Buffer
def readBigInt64BE(): BigInt
Inherited from
Buffer
def readBigInt64LE(offset: Double): BigInt
Inherited from
Buffer
def readBigInt64LE(): BigInt
Inherited from
Buffer
def readBigUInt64BE(offset: Double): BigInt
Inherited from
Buffer
def readBigUInt64BE(): BigInt
Inherited from
Buffer
def readBigUInt64LE(offset: Double): BigInt
Inherited from
Buffer
def readBigUInt64LE(): BigInt
Inherited from
Buffer
def readDoubleBE(offset: Double): Double
Inherited from
Buffer
def readDoubleBE(): Double
Inherited from
Buffer
def readDoubleLE(offset: Double): Double
Inherited from
Buffer
def readDoubleLE(): Double
Inherited from
Buffer
def readFloatBE(offset: Double): Double
Inherited from
Buffer
def readFloatBE(): Double
Inherited from
Buffer
def readFloatLE(offset: Double): Double
Inherited from
Buffer
def readFloatLE(): Double
Inherited from
Buffer
def readInt16BE(offset: Double): Double
Inherited from
Buffer
def readInt16BE(): Double
Inherited from
Buffer
def readInt16LE(offset: Double): Double
Inherited from
Buffer
def readInt16LE(): Double
Inherited from
Buffer
def readInt32BE(offset: Double): Double
Inherited from
Buffer
def readInt32BE(): Double
Inherited from
Buffer
def readInt32LE(offset: Double): Double
Inherited from
Buffer
def readInt32LE(): Double
Inherited from
Buffer
def readInt8(offset: Double): Double
Inherited from
Buffer
def readInt8(): Double
Inherited from
Buffer
def readIntBE(offset: Double, byteLength: Double): Double
Inherited from
Buffer
def readIntLE(offset: Double, byteLength: Double): Double
Inherited from
Buffer
def readUInt16BE(offset: Double): Double
Inherited from
Buffer
def readUInt16BE(): Double
Inherited from
Buffer
def readUInt16LE(offset: Double): Double
Inherited from
Buffer
def readUInt16LE(): Double
Inherited from
Buffer
def readUInt32BE(offset: Double): Double
Inherited from
Buffer
def readUInt32BE(): Double
Inherited from
Buffer
def readUInt32LE(offset: Double): Double
Inherited from
Buffer
def readUInt32LE(): Double
Inherited from
Buffer
def readUInt8(offset: Double): Double
Inherited from
Buffer
def readUInt8(): Double
Inherited from
Buffer
def readUIntBE(offset: Double, byteLength: Double): Double
Inherited from
Buffer
def readUIntLE(offset: Double, byteLength: Double): Double
Inherited from
Buffer
def reduce[U](callbackfn: Function4[U, Double, Double, Buffer, U], initialValue: U): U

Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

Value Params
callbackfn

A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

initialValue

If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

Inherited from
Uint8Array
def reduce(callbackfn: Function4[Double, Double, Double, Buffer, Double], initialValue: Double): Double
Inherited from
Uint8Array
def reduce(callbackfn: Function4[Double, Double, Double, Buffer, Double]): Double

Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

Value Params
callbackfn

A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.

initialValue

If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

Inherited from
Uint8Array
def reduceRight[U](callbackfn: Function4[U, Double, Double, Buffer, U], initialValue: U): U

Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

Value Params
callbackfn

A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.

initialValue

If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

Inherited from
Uint8Array
def reduceRight(callbackfn: Function4[Double, Double, Double, Buffer, Double], initialValue: Double): Double
Inherited from
Uint8Array
def reduceRight(callbackfn: Function4[Double, Double, Double, Buffer, Double]): Double

Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.

Value Params
callbackfn

A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.

initialValue

If initialValue is specified, it is used as the initial value to start the accumulation. The first call to the callbackfn function provides this value as an argument instead of an array value.

Inherited from
Uint8Array
def reverse(): Uint8Array

Reverses the elements in an Array.

Reverses the elements in an Array.

Inherited from
Uint8Array
def set(array: ArrayLike[Double], offset: Double): Unit
Inherited from
Uint8Array
def set(array: ArrayLike[Double]): Unit

Sets a value or an array of values.

Sets a value or an array of values.

Value Params
array

A typed or untyped array of values to set.

offset

The index in the current array at which the values are to be written.

Inherited from
Uint8Array
def slice(start: Unit, end: Double): Uint8Array
Inherited from
Uint8Array
def slice(start: Double, end: Double): Uint8Array
Inherited from
Uint8Array
def slice(start: Double): Uint8Array
Inherited from
Uint8Array
def slice(): Uint8Array

Returns a section of an array.

Returns a section of an array.

Value Params
end

The end of the specified portion of the array. This is exclusive of the element at the index 'end'.

start

The beginning of the specified portion of the array.

Inherited from
Uint8Array
def some(predicate: Function3[Double, Double, Buffer, Any], thisArg: Any): Boolean
Inherited from
Uint8Array
def some(predicate: Function3[Double, Double, Buffer, Any]): Boolean

Determines whether the specified callback function returns true for any element of an array.

Determines whether the specified callback function returns true for any element of an array.

Value Params
predicate

A function that accepts up to three arguments. The some method calls the predicate function for each element in the array until the predicate returns a value which is coercible to the Boolean value true, or until the end of the array.

thisArg

An object to which the this keyword can refer in the predicate function. If thisArg is omitted, undefined is used as the this value.

Inherited from
Uint8Array
def sort(compareFn: Function2[Double, Double, Double]): Buffer
Inherited from
Uint8Array
def sort(): Buffer

Sorts an array.

Sorts an array.

Value Params
compareFn

Function used to determine the order of the elements. It is expected to return a negative value if first argument is less than second argument, zero if they're equal and a positive value otherwise. If omitted, the elements are sorted in ascending, ASCII character order.

[11,2,22,1].sort((a, b) => a - b)
Inherited from
Uint8Array
def subarray(begin: Unit, end: Double): Uint8Array
Inherited from
Uint8Array
def subarray(begin: Double, end: Double): Uint8Array
Inherited from
Uint8Array
def subarray(begin: Double): Uint8Array
Inherited from
Uint8Array
def subarray(): Uint8Array

Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements at begin, inclusive, up to end, exclusive.

Gets a new Uint8Array view of the ArrayBuffer store for this array, referencing the elements at begin, inclusive, up to end, exclusive.

Value Params
begin

The index of the beginning of the array.

end

The index of the end of the array.

Inherited from
Uint8Array
def swap16(): Buffer
Inherited from
Buffer
def swap32(): Buffer
Inherited from
Buffer
def swap64(): Buffer
Inherited from
Buffer
def toJSON(): Data
Inherited from
Buffer
def toLocaleString(): String
Inherited from
Object
def toString(encoding: Unit, start: Unit, end: Double): String
Inherited from
Buffer
def toString(encoding: Unit, start: Double, end: Double): String
Inherited from
Buffer
def toString(encoding: Unit, start: Double): String
Inherited from
Buffer
def toString(encoding: BufferEncoding, start: Unit, end: Double): String
Inherited from
Buffer
def toString(encoding: BufferEncoding, start: Double, end: Double): String
Inherited from
Buffer
def toString(encoding: BufferEncoding, start: Double): String
Inherited from
Buffer
def toString(encoding: BufferEncoding): String
Inherited from
Buffer
def valueOf(): Any
Inherited from
Object
def values(): IterableIterator[Double]

Returns an list of values in the array

Returns an list of values in the array

Inherited from
Uint8Array
def write(string: String, offset: Double, length: Double, encoding: BufferEncoding): Double
Inherited from
Buffer
def write(string: String, offset: Double, length: Double): Double
Inherited from
Buffer
def write(string: String, offset: Double, encoding: BufferEncoding): Double
Inherited from
Buffer
def write(string: String, offset: Double): Double
Inherited from
Buffer
def write(string: String, encoding: BufferEncoding): Double
Inherited from
Buffer
def write(string: String): Double
Inherited from
Buffer
def writeBigInt64BE(value: BigInt, offset: Double): Double
Inherited from
Buffer
def writeBigInt64BE(value: BigInt): Double
Inherited from
Buffer
def writeBigInt64LE(value: BigInt, offset: Double): Double
Inherited from
Buffer
def writeBigInt64LE(value: BigInt): Double
Inherited from
Buffer
def writeBigUInt64BE(value: BigInt, offset: Double): Double
Inherited from
Buffer
def writeBigUInt64BE(value: BigInt): Double
Inherited from
Buffer
def writeBigUInt64LE(value: BigInt, offset: Double): Double
Inherited from
Buffer
def writeBigUInt64LE(value: BigInt): Double
Inherited from
Buffer
def writeDoubleBE(value: Double, offset: Double): Double
Inherited from
Buffer
def writeDoubleBE(value: Double): Double
Inherited from
Buffer
def writeDoubleLE(value: Double, offset: Double): Double
Inherited from
Buffer
def writeDoubleLE(value: Double): Double
Inherited from
Buffer
def writeFloatBE(value: Double, offset: Double): Double
Inherited from
Buffer
def writeFloatBE(value: Double): Double
Inherited from
Buffer
def writeFloatLE(value: Double, offset: Double): Double
Inherited from
Buffer
def writeFloatLE(value: Double): Double
Inherited from
Buffer
def writeInt16BE(value: Double, offset: Double): Double
Inherited from
Buffer
def writeInt16BE(value: Double): Double
Inherited from
Buffer
def writeInt16LE(value: Double, offset: Double): Double
Inherited from
Buffer
def writeInt16LE(value: Double): Double
Inherited from
Buffer
def writeInt32BE(value: Double, offset: Double): Double
Inherited from
Buffer
def writeInt32BE(value: Double): Double
Inherited from
Buffer
def writeInt32LE(value: Double, offset: Double): Double
Inherited from
Buffer
def writeInt32LE(value: Double): Double
Inherited from
Buffer
def writeInt8(value: Double, offset: Double): Double
Inherited from
Buffer
def writeInt8(value: Double): Double
Inherited from
Buffer
def writeIntBE(value: Double, offset: Double, byteLength: Double): Double
Inherited from
Buffer
def writeIntLE(value: Double, offset: Double, byteLength: Double): Double
Inherited from
Buffer
def writeUInt16BE(value: Double, offset: Double): Double
Inherited from
Buffer
def writeUInt16BE(value: Double): Double
Inherited from
Buffer
def writeUInt16LE(value: Double, offset: Double): Double
Inherited from
Buffer
def writeUInt16LE(value: Double): Double
Inherited from
Buffer
def writeUInt32BE(value: Double, offset: Double): Double
Inherited from
Buffer
def writeUInt32BE(value: Double): Double
Inherited from
Buffer
def writeUInt32LE(value: Double, offset: Double): Double
Inherited from
Buffer
def writeUInt32LE(value: Double): Double
Inherited from
Buffer
def writeUInt8(value: Double, offset: Double): Double
Inherited from
Buffer
def writeUInt8(value: Double): Double
Inherited from
Buffer
def writeUIntBE(value: Double, offset: Double, byteLength: Double): Double
Inherited from
Buffer
def writeUIntLE(value: Double, offset: Double, byteLength: Double): Double
Inherited from
Buffer

Inherited fields

val BYTES_PER_ELEMENT: Double

The size in bytes of each element in the array.

The size in bytes of each element in the array.

Inherited from
Uint8Array

The ArrayBuffer instance referenced by the array.

The ArrayBuffer instance referenced by the array.

Inherited from
Uint8Array
val byteLength: Double

The length in bytes of the array.

The length in bytes of the array.

Inherited from
Uint8Array
val byteOffset: Double

The offset in bytes of the array.

The offset in bytes of the array.

Inherited from
Uint8Array
@JSName
var iterator: Function0[IterableIterator[Double]]
Inherited from
Uint8Array
val length: Double

The length of the array.

The length of the array.

Inherited from
Uint8Array
@JSName
Inherited from
Uint8Array