# Namespace: ProtoBuf

## ProtoBuf

The ProtoBuf namespace.

Source:
  - ProtoBuf.js, line 33

### Classes

Builder

### Namespaces

DotProto
Reflect
Util

### Members

#### (static, non-null) ByteBuffer :function

  ##### Type:

  - function
  Source:
    - ProtoBuf.js, line 213

#### (static) convertFieldsToCamelCase :boolean

  If set to `true`, field names will be converted from underscore notation to camel case. Defaults to `false`. Must be set prior to parsing.

  ##### Type:

  - boolean
  Source:
    - ProtoBuf.js, line 227

#### (static, constant) ID_MAX :number

  Maximum field id.

  ##### Type:

  - number
  Source:
    - ProtoBuf.js, line 207

#### (static, constant) ID_MIN :number

  Minimum field id.

  ##### Type:

  - number
  Source:
    - ProtoBuf.js, line 199

#### (static, non-null) Lang :Object.<string, (string|!RegExp)>

  Language expressions.

  ##### Type:

  - Object.<string, (string|!RegExp)>
  Source:
    - ProtoBuf.js, line 375

#### (static, nullable) Long :function

  ##### Type:

  - function
  Source:
    - ProtoBuf.js, line 219

#### (static, constant, non-null) PACKABLE_WIRE_TYPES :Array.<number>

  Packable wire types.

  ##### Type:

  - Array.<number>
  Source:
    - ProtoBuf.js, line 104

#### (static) populateAccessors :boolean

  By default, messages are populated with (setX, set_x) accessors for each field. This can be disabled by setting this to `false` prior to building messages.

  ##### Type:

  - boolean
  Source:
    - ProtoBuf.js, line 235

#### (static, constant) TYPES :Object.<string, {name: string, wireType: number}>

  Types.

  ##### Type:

  - Object.<string, {name: string, wireType: number}>
  Source:
    - ProtoBuf.js, line 117

#### (static, constant) VERSION :string

  ProtoBuf.js version.

  ##### Type:

  - string
  Source:
    - ProtoBuf.js, line 41

#### (static, constant) WIRE_TYPES :Object.<string, number>

  Wire types.

  ##### Type:

  - Object.<string, number>
  Source:
    - ProtoBuf.js, line 49

#### (static, constant) WIRE_TYPES.BITS32 :number

  Fixed 32 bits wire type.

  ##### Type:

  - number
  Source:
    - ProtoBuf.js, line 96

#### (static, constant) WIRE_TYPES.BITS64 :number

  Fixed 64 bits wire type.

  ##### Type:

  - number
  Source:
    - ProtoBuf.js, line 64

#### (static, constant) WIRE_TYPES.ENDGROUP :number

  End group wire type.

  ##### Type:

  - number
  Source:
    - ProtoBuf.js, line 88

#### (static, constant) WIRE_TYPES.LDELIM :number

  Length delimited wire type.

  ##### Type:

  - number
  Source:
    - ProtoBuf.js, line 72

#### (static, constant) WIRE_TYPES.STARTGROUP :number

  Start group wire type.

  ##### Type:

  - number
  Source:
    - ProtoBuf.js, line 80

#### (static) WIRE_TYPES.VARINT :number

  Varint wire type.

  ##### Type:

  - number
  Source:
    - ProtoBuf.js, line 56

### Methods

#### (static) loadJson(json, builderopt, filenameopt) → {ProtoBuf.Builder}

  Loads a .json definition and returns the Builder.

  ##### Parameters:

  Name | Type | Attributes | Description
  --- | --- | --- | ---
  `json` | * | string |  | JSON definition
  `builder` | ProtoBuf.Builder | string | Object | <optional> | Builder to append to. Will create a new one if omitted.
  `filename` | string | Object | <optional> | The corresponding file name if known. Must be specified for imports.

  Source:
    - ProtoBuf.js, line 4278

  ##### Throws:

  If the definition cannot be parsed or built
  Type
    Error

  ##### Returns:

  Builder to create new messages

  Type
    ProtoBuf.Builder

#### (static) loadJsonFile(filename, callbackopt, builderopt) → {ProtoBuf.Builder|undefined}

  Loads a .json file and returns the Builder.

  ##### Parameters:

  Name | Type | Attributes | Description
  --- | --- | --- | ---
  `filename` | string | Object |  | Path to json file or an object specifying 'file' with an overridden 'root' path for all imported files.
  `callback` | function | <optional> | Callback that will receive `null` as the first and the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the file will be read synchronously and this function will return the Builder.
  `builder` | ProtoBuf.Builder | <optional> | Builder to append to. Will create a new one if omitted.

  Source:
    - ProtoBuf.js, line 4303

  ##### Returns:

  The Builder if synchronous (no callback specified, will be NULL if the request has failed), else undefined

  Type
    ProtoBuf.Builder | undefined

#### (static) loadProto(proto, builderopt, filenameopt) → {ProtoBuf.Builder}

  Loads a .proto string and returns the Builder.

  ##### Parameters:

  Name | Type | Attributes | Description
  --- | --- | --- | ---
  `proto` | string |  | .proto file contents
  `builder` | ProtoBuf.Builder | string | Object | <optional> | Builder to append to. Will create a new one if omitted.
  `filename` | string | Object | <optional> | The corresponding file name if known. Must be specified for imports.

  Source:
    - ProtoBuf.js, line 4185

  ##### Throws:

  If the definition cannot be parsed or built
  Type
    Error

  ##### Returns:

  Builder to create new messages

  Type
    ProtoBuf.Builder

#### (static) loadProtoFile(filename, callbackopt, builderopt) → {ProtoBuf.Builder|undefined}

  Loads a .proto file and returns the Builder.

  ##### Parameters:

  Name | Type | Attributes | Description
  --- | --- | --- | ---
  `filename` | string | Object |  | Path to proto file or an object specifying 'file' with an overridden 'root' path for all imported files.
  `callback` | function | <optional> | Callback that will receive `null` as the first and the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the file will be read synchronously and this function will return the Builder.
  `builder` | ProtoBuf.Builder | <optional> | Builder to append to. Will create a new one if omitted.

  Source:
    - ProtoBuf.js, line 4216

  ##### Returns:

  The Builder if synchronous (no callback specified, will be NULL if the request has failed), else undefined

  Type
    ProtoBuf.Builder | undefined

#### (static) newBuilder(optionsopt) → (non-null) {ProtoBuf.Builder}

  Constructs a new empty Builder.

  ##### Parameters:

  Name | Type | Attributes | Description
  --- | --- | --- | ---
  `options` | Object.<string, *> | <optional> | Builder options, defaults to global options set on ProtoBuf

  Source:
    - ProtoBuf.js, line 4260

  ##### Returns:

  Builder

  Type
    ProtoBuf.Builder

#### (static) protoFromFile(filename, callbackopt, builderopt) → {ProtoBuf.Builder|undefined}

  Loads a .proto file and returns the Builder. This is an alias of ProtoBuf.loadProtoFile.

  ##### Parameters:

  Name | Type | Attributes | Description
  --- | --- | --- | ---
  `filename` | string | Object |  | Path to proto file or an object specifying 'file' with an overridden 'root' path for all imported files.
  `callback` | function | <optional> | Callback that will receive `null` as the first and the Builder as its second argument on success, otherwise the error as its first argument. If omitted, the file will be read synchronously and this function will return the Builder.
  `builder` | ProtoBuf.Builder | <optional> | Builder to append to. Will create a new one if omitted.

  Source:
    - ProtoBuf.js, line 4251

  ##### Returns:

  The Builder if synchronous (no callback specified, will be NULL if the request has failed), else undefined

  Type
    ProtoBuf.Builder | undefined

#### (static) protoFromString(proto, builderopt, filenameopt) → {ProtoBuf.Builder}

  Loads a .proto string and returns the Builder. This is an alias of ProtoBuf.loadProto.

  ##### Parameters:

  Name | Type | Attributes | Description
  --- | --- | --- | ---
  `proto` | string |  | .proto file contents
  `builder` | ProtoBuf.Builder | string | <optional> | Builder to append to. Will create a new one if omitted.
  `filename` | string | Object | <optional> | The corresponding file name if known. Must be specified for imports.

  Source:
    - ProtoBuf.js, line 4202

  ##### Throws:

  If the definition cannot be parsed or built
  Type
    Error

  ##### Returns:

  Builder to create new messages

  Type
    ProtoBuf.Builder