nodejs图片转换字节保存
2015-10-21 18:15
483 查看
fs.readFile('上传图片路径', function(err, data) { if (err) { // 错误处理 return; } var base64str = new Buffer(data).toString('base64'); // 图片转换为字节 fs.writeFileSync('copy.jpg', base64str); // 字节流保存为图片 });
相关文章推荐
- nodejs实战express笔记之实现用户和文章页面
- Nodejs 模块
- 使用 AngularJS & NodeJS 实现基于 token 的认证应用
- Node入门训练【7】【用express写出hello world】
- node.js学习网址
- Understanding the node.js event loop
- LeetCode 19 Remove Nth Node From End of List(从列表尾部删除第N个结点)(*)
- Node入门训练【6】【将data写本地log】
- nodeJS实现图片上传和展示
- Node入门训练【4】【根据url路径参数打印相应盘符目录】
- nodejs实战express之使用Markdown
- 自己写的一本nodejs小教程
- LeetCode 19: Remove Nth Node From End of List
- node-mysql使用
- Node入门训练【3】【打印本地目录下的所有文件名】
- Node入门【2】【打印本地文件内容】
- Node.js中的异步执行
- LLVM 笔记(二)—— PHI node
- Populating Next Right Pointers in Each Node II--leetcode难题讲解系列
- nodejs开发环境sublime配置