最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
使用node.js对音视频文件加密的实例代码
时间:2017-08-31 编辑:猪哥 来源:一聚教程网
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 };
-
下一个: 页面引入js
相关文章
- js实现音乐播放器代码展示 10-12
- js实现图片查看器代码展示 10-12
- JS中switch的四种写法介绍 10-12
- js实现新闻轮播效果教程 10-11
- JS实现简单的图片切换功能教程 10-11
- js实现下拉刷新和上拉加载解析 09-28