Flusspferd API and module docs

class binary.ByteString

Includes

Constructor

new binary.ByteString(length)
new binary.ByteString(bytes)
new binary.ByteString(string[, charset="UTF-8"])
  • length (Number) – length of new string
  • bytes (Array | binary.Binary) – contents of new blob.

Create a new ByteString. length creates a new ByteString of this length where every byte is 0. bytes is either another blob to copy, or an array of byte values. The third form is constructed by encoding string to bytes using charset.

ByteStrings are immutable.

Class methods

  • join #

    binary.ByteString.join(args, sep) ⇒ binary.ByteString
    • args (Array):
    • sep (binary.Binary):

Instance properties

  • length #

    binary.ByteString#length -> Number

    Length of the string in bytes. Read Only

Instance methods

  • charCodeAt #

    binary.ByteString#charCodeAt(index) ⇒ Number

    Alias of: binary.Binary#get

  • substr #

    binary.ByteString#substr(start[, howMany]) ⇒ binary.ByteString
    • start (Number) – byte index to start at
    • howMany (Number) – maximum length of returned ByteString

    Return a new ByteString with the contents of the length range [start, howMany).

    Behaves similarly to String#substr

  • substring #

    binary.ByteString#substring(start[, end]) ⇒ binary.ByteString
    • start (Number) – byte index to start at
    • end (Number) – final byte index. Defaults to end of blob

    Return a new ByteString with the contents of the range [start, end).

    Behaves similarly to String#substring