Skip to content

Commit

Permalink
Docs: Added a hint on using .create to initial example [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
dcodeIO committed Mar 23, 2017
1 parent b9574ad commit 6f8f2c1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ protobuf.load("awesome.proto", function(err, root) {
throw err;

// Obtain a message type
var AwesomeMessage = root.lookup("awesomepackage.AwesomeMessage");
var AwesomeMessage = root.lookupType("awesomepackage.AwesomeMessage");

// Exemplary payload
var payload = { awesomeField: "AwesomeString" };
Expand All @@ -194,7 +194,7 @@ protobuf.load("awesome.proto", function(err, root) {
throw Error(errMsg);

// Create a new message
var message = AwesomeMessage.fromObject(payload);
var message = AwesomeMessage.fromObject(payload); // or use .create if payload is already known to be valid

// Encode a message to an Uint8Array (browser) or Buffer (node)
var buffer = AwesomeMessage.encode(message).finish();
Expand Down

0 comments on commit 6f8f2c1

Please sign in to comment.