Hiện tại mình đang sử dụng thư viện protobufjs và muốn đợi nó decode xong mới thực hiện tiếp tục các lệnh phía dưới thì có thể làm như nào ạ. Bên dưới là code của mình
var id = decodeProtobuf(buffer);
switch(id) {
default:
break;
}
function decodeProtobuf(buffer){
protobuf.load(file,function(err,root){
return root.decode(buffer);
});
}