time-to-botec/js/node_modules/@stdlib/buffer/ctor/docs/repl.txt

92 lines
1.4 KiB
Plaintext
Raw Normal View History

{{alias}}
Buffer constructor.
{{alias}}( size )
Allocates a buffer having a specified number of bytes.
Parameters
----------
size: integer
Number of bytes to allocate.
Returns
-------
out: Buffer
Buffer instance.
Examples
--------
> var b = new {{alias}}( 4 )
<Buffer>
{{alias}}( buffer )
Copies buffer data to a new Buffer instance.
Parameters
----------
buffer: Buffer
Buffer to copy from.
Returns
-------
out: Buffer
Buffer instance.
Examples
--------
> var b1 = new {{alias}}( [ 1, 2, 3, 4 ] );
> var b2 = new {{alias}}( b1 )
<Buffer>[ 1, 2, 3, 4 ]
{{alias}}( array )
Allocates a buffer using an array of octets.
Parameters
----------
array: Array
Array of octets.
Returns
-------
out: Buffer
Buffer instance.
Examples
--------
> var b = new {{alias}}( [ 1, 2, 3, 4 ] )
<Buffer>[ 1, 2, 3, 4 ]
{{alias}}( str[, encoding] )
Allocates a buffer containing a provided string.
Parameters
----------
str: string
Input string.
encoding: string (optional)
Character encoding. Default: 'utf8'.
Returns
-------
out: Buffer
Buffer instance.
Examples
--------
> var b = new {{alias}}( 'beep boop' )
<Buffer>
TODO: add methods and properties
See Also
--------