forked from gagle/node-bufferedreader
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Gabriel Llamas
committed
Jul 25, 2012
1 parent
9e384fa
commit e3183a3
Showing
11 changed files
with
79 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,16 @@ | ||
var BufferedReader = require ("../build/buffered-reader"); | ||
|
||
var handleError = function (bufferedReader, error, cb){ | ||
console.log (error); | ||
if (!bufferedReader) return cb (); | ||
|
||
bufferedReader.close (function (error){ | ||
if (error) console.log (error); | ||
cb (); | ||
}); | ||
}; | ||
|
||
new BufferedReader ("file", { start: 3, end: 6 }).seek (1, function (error){ | ||
if (error) return handleError (null, error, function (){ /* Error correctly managed. */ }); | ||
if (error) return console.log (error); | ||
|
||
this.readBytes (10, function (error, bytes, bytesRead){ | ||
if (error) return handleError (this, error, function (){ /* Error correctly managed. */ }); | ||
if (error) return console.log (error); | ||
|
||
console.log (bytes); | ||
console.log ("bytes read: " + bytesRead); | ||
console.log (bytes); //Prints: 0x44 0x55 0x66 | ||
console.log ("bytes read: " + bytesRead); //Prints: 3 | ||
|
||
this.close (function (error){ | ||
if (error) handleError (null, error, function (){ /* Error correctly managed. */ }); | ||
if (error) console.log (error); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.