How to use the safer-buffer.Buffer.byteLength function in safer-buffer

To help you get started, we’ve selected a few safer-buffer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github joyent / node-asn1 / lib / ber / writer.js View on Github external
Writer.prototype.writeString = function (s, tag) {
  if (typeof (s) !== 'string')
    throw new TypeError('argument must be a string (was: ' + typeof (s) + ')');
  if (typeof (tag) !== 'number')
    tag = ASN1.OctetString;

  var len = Buffer.byteLength(s);
  this.writeByte(tag);
  this.writeLength(len);
  if (len) {
    this._ensure(len);
    this._buf.write(s, this._offset);
    this._offset += len;
  }
};

safer-buffer

Modern Buffer API polyfill without footguns

MIT
Latest version published 6 years ago

Package Health Score

65 / 100
Full package analysis

Similar packages