title: nodejs add null terminated string to buffer
body: <p>I am trying to replicate a packet.</p>
  
  <p>This packet:</p>
  
  <pre><code>2C 00 65 00 03 00 00 00   00 00 00 00 42 4C 41 5A
  45 00 00 00 00 00 00 00   00 42 4C 41 5A 45......
  </code></pre>
  
  <p><code>2c 00</code> is the size of the packet...<br>
  <code>65 00</code> is the packet id 101...<br>
  <code>03 00</code> is the number of elements in the array...  </p>
  
  <p>Now here comes my problem, <code>42 4C 41 5A 45</code> is a string... There are exactly 3 Instances of that string in that packet if it is complete... But my problem is it is not just null terminated it has <code>00 00 00 00</code> spaces between those instances.</p>
  
  <p>My code:</p>
  
  <pre><code>function channel_list(channels) {
    var packet = new SmartBuffer();
  
    packet.writeUInt16LE(101); // response packet for list of channels
    packet.writeUInt16LE(channels.length)
  
    channels.forEach(function (key){
      console.log(key);
      packet.writeStringNT(key);
    });
  
    packet.writeUInt16LE(packet.length + 2, 0);
  
    console.log(packet.toBuffer());
  }
  </code></pre>
  
  <p>But how do I add the padding?</p>
  
  <p>I am using this package, <a href="https://github.com/JoshGlazebrook/smart-buffer/" rel="nofollow">https://github.com/JoshGlazebrook/smart-buffer/</a></p>