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

29 lines
508 B
Plaintext
Raw Normal View History

{{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 = {{alias}}( 'beep boop' )
<Buffer>
> b = {{alias}}( '7468697320697320612074c3a97374', 'hex' );
> b.toString()
'this is a tést'
See Also
--------