A
A
adsprosto2017-03-08 01:34:59
JavaScript
adsprosto, 2017-03-08 01:34:59

How to use encryption in NodeJs?

How to encrypt file contents in nodejs?
Now we have this code:
streamwrite = fs.createWriteStream(path);
streamread = fs.createReadStream('local');
streamread.on('readable', function() {
var data;
while(null !== (data = streamread.read(4096))){
var buf = new Buffer(data);
streamwrite.write(buf.toString( 'hex'));
delete data,buf;
}
});
streamread.on('end', function() {
});
streamread.on('error',function(er){
});
streamread.on('close', function() {
delete streamread;
});
When decrypting, it gives out a couple of characters in the form of krakozyabr, how to solve this problem?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Philipp, 2017-03-08
@adsprosto

lollyrock.com/articles/nodejs-encryption

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question