repl.txt (580B)
1 2 {{alias}}( buffer ) 3 Returns a JSON representation of a buffer. 4 5 The returned JSON object has the following properties: 6 7 - type: value type 8 - data: buffer data as a generic array 9 10 Parameters 11 ---------- 12 buffer: Buffer 13 Buffer to serialize. 14 15 Returns 16 ------- 17 out: Object 18 JSON representation. 19 20 Examples 21 -------- 22 > var buf = new {{alias:@stdlib/buffer/alloc-unsafe}}( 2 ); 23 > buf[ 0 ] = 1; 24 > buf[ 1 ] = 2; 25 > var json = {{alias}}( buf ) 26 { 'type': 'Buffer', 'data': [ 1, 2 ] } 27 28 See Also 29 -------- 30