Permalink
Browse files

Added example

  • Loading branch information...
1 parent ca019f0 commit e61213967ced0a198cd57a1ed719f928b8fd9edb @unixpickle committed Mar 18, 2012
Showing with 16 additions and 0 deletions.
  1. +16 −0 JSKBKit/example.js
View
@@ -0,0 +1,16 @@
+/** This is how encoding/decoding might look **/
+
+require('./node_include.js');
+
+// encode
+var enc = new KBEncode(new KBBuffer(1));
+enc.encode([1337, -3.14, -65536, 'test', false, null, {'hi': 10}]);
+
+// get encoded buffer for decoding
+var buff = enc.buffer;
+buff.offset = 0;
+
+// decode
+var dec = new KBDecode(buff);
+var decoded = dec.decode();
+console.log(decoded);

0 comments on commit e612139

Please sign in to comment.