code: function stringToBuffer(str) {
      var buf = new Buffer(str.length);
      for (var i = 0; i < buf.length; i++) {
        buf.writeUInt8(str.charCodeAt(i), i);
      }
      return buf;
    }
docs: Converts a string to a Buffer