Permalink
Browse files

README.md: use pipe in example

  • Loading branch information...
1 parent b3979e0 commit 5b5fa7237f146188ddd57f584d1bdc4b45f9f75c @dominictarr dominictarr committed with May 28, 2012
Showing with 11 additions and 13 deletions.
  1. +11 −13 README.md
View
24 README.md
@@ -10,16 +10,14 @@ Example Usage:
var e = new EncryptStream(key);
var d = new DecryptStream(key);
- e.addListener('data', function(chunk) {
- d.write(chunk);
- });
- e.addListener('end', function() {
- d.end();
- });
- d.addListener('data', function(chunk) {
- if (chunk.length > 0)
- console.log('data: ' + chunk);
- });
-
- e.write("Hello world", 'binary');
- e.end();
+ fs.createReadStream(__filename).pipe(e).pipe(d).pipe(process.stdout, {end: false})
+
+EncryptStream/DecryptStream (opts)
+
+`opts` may be a the key (string) or a object. If `opts` is an object it _must_
+have properties for `key` and `algorithm`, and _may_ have properties
+`inputEncoding` and `outputEncoding`
+
+also see [crypto.createCypher][createCypher]
+
+[createCypher]: http://nodejs.org/api/crypto.html#crypto_crypto_createcipher_algorithm_password

0 comments on commit 5b5fa72

Please sign in to comment.