time-to-botec/squiggle/node_modules/@stdlib/buffer/ctor/docs/repl.txt
NunoSempere b6addc7f05 feat: add the node modules
Necessary in order to clearly see the squiggle hotwiring.
2022-12-03 12:44:49 +00:00

92 lines
1.4 KiB
Plaintext

{{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
--------