Returns a JSON representation of a Buffer.
Buffer
first argument must be a Buffer
buffer to serialize
JSON representation
var array2buffer = require( `@stdlib/buffer/from-array` ); var buf = array2buffer( [ 1, 2 ] ); // returns <Buffer> var json = toJSON( buf ); // returns { 'type': 'Buffer', 'data': [ 1, 2 ] }
Returns a JSON representation of a
Buffer
.first argument must be a
Buffer