Skip to content

Commit

Permalink
Update CryptoStream.js
Browse files Browse the repository at this point in the history
  • Loading branch information
ekettenburg authored Oct 21, 2016
1 parent 9c3452d commit 546a7fe
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions js/lib/CryptoStream.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,13 @@ CryptoStream.prototype.getCipher = function (callback) {
cipher.on('readable', function () {
var chunk = cipher.read();

if (!ciphertext) {
ciphertext = chunk;
}
else {
ciphertext = Buffer.concat([ciphertext, chunk], ciphertext.length + chunk.length);
}
if(chunk){
if (!ciphertext) {
ciphertext = chunk;
}
else {
ciphertext = Buffer.concat([ciphertext, chunk], ciphertext.length + chunk.length);
}
});
cipher.on('end', function () {
//var action = (that.encrypt) ? "encrypting" : "decrypting";
Expand Down

0 comments on commit 546a7fe

Please sign in to comment.