Search code examples
javascriptarraysangulararraybufferprotobuf.js

How to read protobuf object in angular4 received in response of an HTTP request


Trying to read protobuf object instead of JSON object in angular4.

I found this dcodeIO/protobufjs. But I don't understand how should I use this in my project?

I also tried installing the typings for protobufjs using typings install dt~protobufjs --global. When I import it, WebStorm says Cannot find module protobuf.

Any help! Appreciated!


Solution

  • We can read protobuf object in angular4 using google-protobuf library. import syntax is -

    ## import * as goog from 'google-protobuf'; ##
    

    Reference github link is - https://github.com/sparten11740/angular-protobuf-example