您好,欢迎访问一九零五行业门户网

node.js操作音视频文件进行加密

这次给大家带来node.js操作音视频文件进行加密,node.js操作音视频文件进行加密的注意事项有哪些,下面就是实战案例,一起来看一下。
fs.readfile('./downsuccess/'+name+'', {flag: 'r+', encoding: ''}, function (err, data) {           console.log('读取中')           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}加密完成`);             _this.downall(_this.downlist,_this.downcall)           })         }); export function cipher (buf) {   var encrypted = ;   var cip = crypto.createcipher('rc4', '密匙');   encrypted += cip.update(buf, 'hex', 'hex');   encrypted += cip.final('hex');   return encrypted };
相信看了本文案例你已经掌握了方法,更多精彩请关注其它相关文章!
推荐阅读:
html标签与dom节点结合
页面内引入js有哪些方法
以上就是node.js操作音视频文件进行加密的详细内容。
其它类似信息

推荐信息