Skip to content
This repository
Browse code

parse example

  • Loading branch information...
commit 5876a651f13e570c0f3b7429eeebd8a79fa5de12 1 parent 2eb9406
James Halliday authored December 13, 2010
16  README.markdown
Source Rendered
@@ -28,6 +28,22 @@ buf.js
28 28
     $ node buf.js
29 29
     { ab: 25185, cf: 1667523942, x: 0 }
30 30
 
  31
+parse.js
  32
+--------
  33
+    var buf = new Buffer([ 97, 98, 99, 100, 101, 102, 0 ]);
  34
+    
  35
+    var Binary = require('binary');
  36
+    var vars = Binary.parse(buf)
  37
+        .word16ls('ab')
  38
+        .word32bu('cf')
  39
+        .word8('x')
  40
+        .vars
  41
+    ;
  42
+    console.dir(vars);
  43
+-
  44
+    $ node parse.js
  45
+    { ab: 25185, cf: 1667523942, x: 0 }
  46
+
31 47
 stream.js
32 48
 ---------
33 49
 
10  examples/parse.js
... ...
@@ -0,0 +1,10 @@
  1
+var buf = new Buffer([ 97, 98, 99, 100, 101, 102, 0 ]);
  2
+
  3
+var Binary = require('binary');
  4
+var vars = Binary.parse(buf)
  5
+    .word16ls('ab')
  6
+    .word32bu('cf')
  7
+    .word8('x')
  8
+    .vars
  9
+;
  10
+console.dir(vars);

0 notes on commit 5876a65

Please sign in to comment.
Something went wrong with that request. Please try again.