time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

repl.txt (1368B)


      1 
      2 {{alias}}( buf[, byteOffset[, length]] )
      3     Allocates a buffer from an ArrayBuffer.
      4 
      5     The behavior of this function varies across Node.js versions due to changes
      6     in the underlying Node.js APIs:
      7 
      8     - <3.0.0: the function copies ArrayBuffer bytes to a new Buffer instance.
      9     - >=3.0.0 and <5.10.0: if provided a byte offset, the function copies
     10       ArrayBuffer bytes to a new Buffer instance; otherwise, the function
     11       returns a view of an ArrayBuffer without copying the underlying memory.
     12     - <6.0.0: if provided an empty ArrayBuffer, the function returns an empty
     13       Buffer which is not an ArrayBuffer view.
     14     - >=6.0.0: the function returns a view of an ArrayBuffer without copying
     15       the underlying memory.
     16 
     17     Parameters
     18     ----------
     19     buf: ArrayBuffer
     20         Input array buffer.
     21 
     22     byteOffset: integer (optional)
     23         Index offset specifying the location of the first byte.
     24 
     25     length: integer (optional)
     26         Number of bytes to expose from the underlying ArrayBuffer.
     27 
     28     Returns
     29     -------
     30     out: Buffer
     31         Buffer instance.
     32 
     33     Examples
     34     --------
     35     > var ab = new {{alias:@stdlib/array/buffer}}( 10 )
     36     <ArrayBuffer>
     37     > var buf = {{alias}}( ab )
     38     <Buffer>
     39     > var len = buf.length
     40     10
     41     > buf = {{alias}}( ab, 2, 6 )
     42     <Buffer>
     43     > len = buf.length
     44     6
     45 
     46     See Also
     47     --------
     48