`protobuf-js' is a Protocol Buffers encoder/decoder for Javascript.
Questions tagged [protobuf.js]
108 questions
21
votes
2 answers
How to get protobuf.js to output enum strings instead of integers
I'm using the latest protobuf.js with Node.js 4.4.5.
I currently struggle to get protobuf.js to output the string definitions of enums instead of integers. I tried several suggestions, but none of them…

Tobi
- 31,405
- 8
- 58
- 90
14
votes
1 answer
How to return a simple boolean value in ProtoBuffer?
in my proto file, I define a service interface:
syntax = "proto3";
package mynamespace;
import "google/protobuf/empty.proto";
service MyService {
rpc isTokenValid (TokenRequest) returns (TokenResponse) {
}
}
message TokenRequest {
…

Jeff Tian
- 5,210
- 3
- 51
- 71
10
votes
4 answers
How to use typescript protobuf generated files in a gRPC angular application
Summarize the problem
I'm learning how to use gRPC, and wanted to try to do a client-server connection. The server (in Elixir) works, though I had a few problems. But as I am mainly a back end developer, I have way more troubles with implementing it…

Aridjar
- 301
- 1
- 5
- 14
10
votes
1 answer
protobuf.js translate proto file to JSON descriptor, repeated gets lost
I'm using Protobuf.js to build a node package, containing our protocol and offering encode and decode functionality to Proto Messages defined in this package. I would be fine with using .proto files (The loading of .proto files happens at runtime) ,…

Bernd Strehl
- 2,852
- 4
- 24
- 43
7
votes
2 answers
How can I test google.protobuf.Timestamp in Javascript?
Using a proto file from an API created in Scala. My code is in JS, trying to test my code and getting the following error:
AssertionError [ERR_ASSERTION]: invalid return value: post[0].lastPublishedDate: Date expected
Tried and didn't…

Yaelz
- 191
- 1
- 1
- 9
7
votes
2 answers
How to encode protocol buffer string to binary using protoc
I been trying to encode strings using protoc cli utility.
Noticed that output still contains plain text.
What am i doing wrong?
osboxes@osboxes:~/proto/bin$ cat ./teststring.proto
syntax = "proto2";
message Test2 {
optional string b = 2;
}
echo…

kpavel
- 262
- 3
- 9
7
votes
1 answer
Protobuf : WebApi -> JS - Decoded object is empty
I would like to send an object from a WebApi controller to an Html page through an Ajax Request.
When I receive the object in JS, it's empty. But server-side the object isn't empty because when I look at the byte[].length it's greater than…

Guillaume
- 844
- 7
- 25
6
votes
0 answers
How to convert object to protobuf data in nodejs
If I have a proto3 message defined as below
message Log {
string object = 1;
string key_result = 2;
string review = 3;
repeated string tag = 4;
string begin_at = 5;
string end_at = 6;
string created_at = 7;
string id = 8;
}
the…

H.C.Liu
- 156
- 1
- 4
6
votes
0 answers
Jest mock testing with protobuf
I am curious if there are testing examples using jest, using dynamically generated node clients in build/protobuf
I am implementing a node client which dynamically generate protobuf files of the service it is calling, and calls the service via grpc.…

Hao Wang
- 61
- 1
6
votes
2 answers
Stopping omission of default values in Protocol Buffers
I have a proto schema defined as below,
message User {
int64 id = 1;
bool email_subscribed = 2;
bool sms_subscribed = 3;
}
Now as per official proto3 documentation, default values are not serialized to save space during wire transmission.…

doto
- 403
- 1
- 5
- 9
5
votes
1 answer
Uploading and Deserializing protobuf data in AWS Lambda
I have a requirement to send protobuf data to an AWS Lambda written in Node.js.
I am experimenting with a "Hello World" example where I serialize and deserialize a Person messge.
Example:
person.proto
syntax = "proto3";
message Person {
…

ChrisRTech
- 547
- 8
- 25
5
votes
3 answers
How to add message type as object in ProtoBuf (gRPC) - Proto3 Syntax?
How to send message type as object in ProtoBuf - Proto3 Syntax?
I want to transfer object instead of string or number.
Example
{
name: 'One',
date: 'date',
some: 'some',
...
...
}
syntax = "proto3";
package db;
service Proxy
{
rpc…

Aravin
- 6,605
- 5
- 42
- 58
5
votes
1 answer
Basic typescript example of using protobufjs
I'm currently implementing some protocol buffers translation in my typescript project. I've gotten the proto files loaded into the ProtoBuilder (using the typescript definitions file from protobufjs.d.ts) and I've returned a ProtoBuf from the…

Chris
- 236
- 3
- 13
4
votes
0 answers
Use protobuf.js in a browser app
I have a very simple browser application, which has to use protobuf:
https://github.com/dcodeIO/protobuf.js
I also have a '.proto' file with a message format, so I just need to encode the incoming messages with protobuf.
Unfortunately I am not able…

Natascha
- 59
- 1
- 3
- 8
4
votes
1 answer
How to load a proto file with imports
I am using the dcodeIO/protobuf.js lib (version 6.8.4) to parse protobuf messages in the browser.
I can make it work with simple proto files, as long as another proto file is not imported.
Importing other proto files in the main one breaks…

n3squik
- 145
- 1
- 2
- 8