Fork me on GitHub

Sections

namespace

UBJSON

Description

Functions and classes, exported from Node.js ubjson module.

class

UBJSON.Int64

Alias of:
class

UBJSON.Stream

Superclass

EventEmitter
Alias of:
class method

UBJSON.packToBuffer

    • UBJSON.packToBuffer(value, buffer, callback)
    • value
      • mixed
    • Value to pack

    • buffer
      • Buffer
    • Buffer to resulting UBJSON data

    • callback
      • Function
    • Callback, gets buffer (error, offset)

Packs JavaScript value into UBJSON.

class method

UBJSON.packToBufferSync

    • UBJSON.packToBufferSync(value, buffer)
      • Integer
    • value
      • mixed
    • Value to pack

    • buffer
      • Buffer
    • Buffer to resulting UBJSON data

Synchronous UBJSON.packToBuffer. Returns buffer offset.

class method

UBJSON.unpackBuffer

    • UBJSON.unpackBuffer(buffer, callback)
    • buffer
      • Buffer
    • Buffer to unpack

    • callback
      • Function
    • Callback, gets JavaScript value

Unpacks buffer with UBJSON data into JavaScript value.

section

Classes section

Description

Exported classes.

Classes

  • Int64

    Value class for storing 64-bit integers as its low and high 32-bit values.

  • UbjsonStream

    Makes possible to send and receive UBJSON data through streams.

class

Int64

Description

Value class for storing 64-bit integers as its low and high 32-bit values.

Constructor

Aliased as:
constructor

Int64.new

    • new Int64(low, high)

Constructs a 64-bit two's-complement integer, given its low and high 32-bit values as signed integers.

instance method

Int64#getHighBitsUnsigned

    • Int64#getHighBitsUnsigned()
      • Number

Returns unsigned 32-bit integer representation of high part.

instance method

Int64#getLowBitsUnsigned

    • Int64#getLowBitsUnsigned()
      • Number

Returns unsigned 32-bit integer representation of low part.

instance method

Int64#toArrayPair

    • Int64#toArrayPair()
      • Array

Returns low and high part of 64-bit integer as array

instance method

Int64#toNumber

    • Int64#toNumber()
      • Number

Returns the Number value: the closest floating-point representation to this 64-bit integer.

class

UbjsonStream

Description

Makes possible to send and receive UBJSON data through streams.

Superclass

EventEmitter

Constructor

Class properties

Instance methods

Instance properties

Aliased as:
constructor

UbjsonStream.new

    • new UbjsonStream(stream)
    • stream
      • Stream
    • Stream to write and read UBJSON data.

Constructs an UbjsonStream instance, use stream for read or/and write packed data.

event

UbjsonStream@end

    • UbjsonStream@end()

Emits on underlying stream end event.

Available only for readable streams.

event

UbjsonStream@error

    • UbjsonStream@error(error)
    • error
      • Error
    • Received error

Emits on parse error.

Available only for readable streams.

event

UbjsonStream@value

    • UbjsonStream@value(value)
    • value
      • mixed
    • Received JavaScript value

Emits on value read from underlying stream.

Available only for readable streams.

class property

UbjsonStream.defaultSendBufferLength

    • UbjsonStream.defaultSendBufferLength
      • Integer
instance method

UbjsonStream#send

    • UbjsonStream#send(value)
      • Integer
    • value
      • mixed
    • JavaScript value to send

Sends an UBJSON-packed value down the stream.

Returns underlying stream write method calls result.

instance property

UbjsonStream#sendBufferLength

    • UbjsonStream#sendBufferLength
      • Integer