Use node. js to encrypt audio and video files.
If you don't talk much about it, paste the Code directly. The specific code is as follows:
Fs. readFile ('. /downsuccess/'+ name + '', {flag: 'r +', encoding:''}, function (err, data) {console. log ('reading... ') if (err) {return;} let B = new Buffer (data); let c = B. toString ('hex'); let cipherBuffer = _ this. cipher (data); fs. writeFile ('. /downsuccess/'+ name + '', cipherBuffer, [], function () {console. log ('$ {name} encrypted'); _ this. downAll (_ this. downList, _ this. downCall)}); export function cipher (buf) {var encrypted = ""; var cip = crypto. createCipher ('rc4', 'key'); encrypted + = cip. update (buf, 'hex', 'hex'); encrypted + = cip. final ('hex'); return encrypted };
Summary
The above section describes how to use node. js will help you with the instance code for audio and video file encryption. If you have any questions, please leave a message and I will reply to you in a timely manner. Thank you very much for your support for the help House website!