![]() ![]() * `arrayBuffer` Encoding to use, Default: `'utf8'`Ĭreates a new `Buffer` containing the given JavaScript string `str`. creates a new Buffer containing ASCII bytesĪ `TypeError` will be thrown if `array` is not an `Array`. But you can use these new explicit APIs to make clear what you want:īom('hey', 'utf8') // convert from many types to a Bufferīuffer.alloc(16) // create a zero-filled buffer (safe)īuffer.allocUnsafe(16) // create an uninitialized buffer (potentially unsafe)Īllocates a new `Buffer` using an `array` of octets.Ĭonst buf = om() New Buffer(16) // create an uninitialized buffer (potentially unsafe) Existing buffer code will continue to work without issues: ![]() Var Buffer = require('safe-buffer').Buffer You can use it by adding one `require` line to The goal of this package is to provide a safe replacement for the node.js `Buffer`. **Uses the built-in implementation when available.** `Buffer.allocUnsafe`, `Buffer.allocUnsafeSlow`) in all versions of Node.js.** **Use the new Node.js Buffer APIs (`om`, `Buffer.alloc`,
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |