Skip to content

Commit

Permalink
Use Buffer.from in the example code
Browse files Browse the repository at this point in the history
  • Loading branch information
keichi committed Jan 11, 2018
1 parent d0526dc commit b137623
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ var ipHeader = new Parser()
});

// Prepare buffer to parse.
var buf = new Buffer("450002c5939900002c06ef98adc24f6c850186d1", "hex");
var buf = Buffer.from("450002c5939900002c06ef98adc24f6c850186d1", "hex");

// Parse buffer and show result
console.log(ipHeader.parse(buf));
Expand Down Expand Up @@ -322,7 +322,7 @@ var parser = new Parser()
// /
// 0

var buffer = new Buffer([
var buffer = Buffer.from([
2,
/* left -> */ 3,
/* one -> */ 1, /* -> */ 0,
Expand Down Expand Up @@ -372,7 +372,7 @@ parser.uint8("type").choice("data", {
}
});

var buffer = new Buffer([2, /* left */ 1, 1, 0, /* right */ 0]);
var buffer = Buffer.from([2, /* left */ 1, 1, 0, /* right */ 0]);

parser.parse(buffer);
```
Expand Down

0 comments on commit b137623

Please sign in to comment.