Permalink
Browse files

modernize examples

  • Loading branch information...
1 parent 033ba8b commit 539071597084c14bb0142d0be94d55b736fe425a @substack committed May 11, 2012
Showing with 8 additions and 7 deletions.
  1. +2 −2 {examples → example}/buf.js
  2. +2 −2 {examples → example}/parse.js
  3. +4 −3 {examples → example}/stream.js
@@ -1,7 +1,7 @@
var buf = new Buffer([ 97, 98, 99, 100, 101, 102, 0 ]);
-var Binary = require('binary');
-Binary(buf)
+var binary = require('binary');
+binary(buf)
.word16ls('ab')
.word32bu('cf')
.word8('x')
@@ -1,7 +1,7 @@
var buf = new Buffer([ 97, 98, 99, 100, 101, 102, 0 ]);
-var Binary = require('binary');
-var vars = Binary.parse(buf)
+var binary = require('binary');
+var vars = binary.parse(buf)
.word16ls('ab')
.word32bu('cf')
.word8('x')
@@ -1,11 +1,12 @@
-var Binary = require('binary');
-var stdin = process.openStdin();
+var binary = require('binary');
-Binary.stream(stdin)
+var ws = binary()
.word32lu('x')
.word16bs('y')
.word16bu('z')
.tap(function (vars) {
console.dir(vars);
})
;
+process.stdin.pipe(ws);
+process.stdin.resume();

0 comments on commit 5390715

Please sign in to comment.