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