使用node.js对音视频文件加密
2017-08-29 18:00
489 查看
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 };
相关文章推荐
- 使用node.js对音视频文件加密的实例代码
- koa使用之node.js 文件加密与解密
- node.js中关于使用formidable模块实现文件上传至指定目录的问题
- node.js 使用 UglifyJS2 高效率压缩 javascript 文件
- 使用Node.js处理前端代码文件的编码问题
- 在Node.js中使用HTTP上传文件的方法
- node.js开发中使用Node Supervisor实现监测文件修改并自动重启应用
- Node.js:使用request模块下载文件
- 关于node.js使用formidable多文件上传解决方案
- React Native + Nodejs 使用RSA加密登录
- node.js 使用fs模块对系统文件及目录进行读写操作
- node.js+android(使用HttpURLConnection和HttpClient)实现文件上传
- 使用nodejs+express(4.x+)实现文件上传
- 使用Node.js处理前端代码文件的编码问题
- node.js开发中使用Node Supervisor实现监测文件修改并自动重启应用
- node.js开发中使用Node Supervisor实现监测文件修改并自动重启
- Node.js 上传文件formidable时使用fs.renameSync报错
- 使用nodejs+express(4.x+)实现文件上传
- node.js开发中使用Node Supervisor实现监测文件修改并自动重启应用
- [Node.js] 使用File API 异步上传文件