I started few days ago to make a project using protobuf but i cant read binary file like a array or json, is it possibly?
syntax = "proto3";
message Employee {
int32 id= 1;
string name = 2;
float temp = 3;
bool status = 4;
}
message Employees{
repeated Employee employees =1;
}
my index: i trying to do it with multiple objects
const Schema = require("./employees_pb");
const fs = require("fs");
const lampada = new Schema.Employee();
lampada.setId(1);
lampada.setName("Lampada");
lampada.setTemp(30);
lampada.setStatus(true);
const televisao = new Schema.Employee();
televisao.setId(2);
televisao.setName("Televisao");
televisao.setTemp(0);
televisao.setStatus(false);
const employees = new Schema.Employees();
employees.addEmployees(lampada);
employees.addEmployees(televisao);
const bytes = employees.serializeBinary();
const employees2 = Schema.Employees.deserializeBinary(bytes);
console.log(employees2);
would the result look like a json?
like:
{id: 1 , name: lampada, temp: 30, status true}...
question from:
https://stackoverflow.com/questions/66045803/how-to-read-file-in-protobuf-using-node-js 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…