How can you allocate a buffer of a specified size without initializing it in Node.js?

  • Buffer.alloc(size)
  • Buffer.create(size)
  • Buffer.new(size)
  • Buffer.allocate(size)
To allocate a buffer of a specified size without initializing it in Node.js, you should use the Buffer.alloc(size) method. It allocates a new buffer of the given size and initializes it with zeros. The other options are not valid methods for achieving this.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *