Permalink
Browse files

updated example

  • Loading branch information...
1 parent e3183a3 commit 5a61ed5446ae4c12cc4508af298014b861ce1a47 Gabriel Llamas committed Jul 25, 2012
Showing with 4 additions and 2 deletions.
  1. +4 −2 examples/seek.js
View
@@ -1,12 +1,14 @@
var BufferedReader = require ("../build/buffered-reader");
-new BufferedReader ("file", { start: 3, end: 6 }).seek (1, function (error){
+new BufferedReader ("file", { start: 3, end: 6 })
+ .seek (1, function (error){
if (error) return console.log (error);
+ //The cursor points to 0x44 (start 3 + seek 1 = 4, from 0)
this.readBytes (10, function (error, bytes, bytesRead){
if (error) return console.log (error);
- console.log (bytes); //Prints: 0x44 0x55 0x66
+ console.log (bytes); //Prints: 0x44 0x55 0x66 (end 6, from 0)
console.log ("bytes read: " + bytesRead); //Prints: 3
this.close (function (error){

0 comments on commit 5a61ed5

Please sign in to comment.