Skip to main content

Class: Duration

google.protobuf.Duration

Represents a Duration.

Properties​

nanos​

• nanos: number

Duration nanos.


seconds​

• seconds: Long

Duration seconds.

Methods​

toJSON​

▸ toJSON(): Object

Converts this Duration to JSON.

Returns​

Object

JSON object


create​

▸ create(properties?): Duration & $Properties

Creates a new Duration instance using the specified properties.

Parameters​

NameTypeDescription
properties?$PropertiesProperties to set

Returns​

Duration & $Properties

Duration instance

▸ create(properties?): Duration

Parameters​

NameType
properties?$Properties

Returns​

Duration


decode​

▸ decode(reader, length?): Duration & $Properties

Decodes a Duration message from the specified reader or buffer.

Parameters​

NameTypeDescription
readerUint8Array | ReaderReader or buffer to decode from
length?numberMessage length if known beforehand

Returns​

Duration & $Properties

Duration

Throws

If the payload is not a reader or valid buffer

Throws

If required fields are missing


decodeDelimited​

▸ decodeDelimited(reader): Duration & $Properties

Decodes a Duration message from the specified reader or buffer, length delimited.

Parameters​

NameTypeDescription
readerUint8Array | ReaderReader or buffer to decode from

Returns​

Duration & $Properties

Duration

Throws

If the payload is not a reader or valid buffer

Throws

If required fields are missing


encode​

▸ encode(message, writer?): Writer

Encodes the specified Duration message. Does not implicitly google.protobuf.Duration.verify|verify messages.

Parameters​

NameTypeDescription
message$PropertiesDuration message or plain object to encode
writer?WriterWriter to encode to

Returns​

Writer

Writer


encodeDelimited​

▸ encodeDelimited(message, writer?): Writer

Encodes the specified Duration message, length delimited. Does not implicitly google.protobuf.Duration.verify|verify messages.

Parameters​

NameTypeDescription
message$PropertiesDuration message or plain object to encode
writer?WriterWriter to encode to

Returns​

Writer

Writer


fromObject​

▸ fromObject(object): Duration

Creates a Duration message from a plain object. Also converts values to their respective internal types.

Parameters​

NameTypeDescription
objectObjectPlain object

Returns​

Duration

Duration


toObject​

▸ toObject(message, options?): Object

Creates a plain object from a Duration message. Also converts values to other types if specified.

Parameters​

NameTypeDescription
messageDurationDuration
options?IConversionOptionsConversion options

Returns​

Object

Plain object