摘自<Node.js 高级编程> var buffer = new Buffer("this is the content of my buffer"); var smallbuffer = buffer.slice(8,19); 这里会有个问题,就是由于子缓冲区在复制的时候,来自于父缓冲区,那么父缓冲区在操作结束的时候,不会被垃圾收集器回收,会带来内存泄漏问题; 新的node.js版本,重新改进了Buffer接口,实测无此问题; new Buffer(array)废弃于:
So, if the array length equals 4, then the size of blob data in mysql DB must be 4 bytes. And it works fine with numbers less than 128. var res = ""; for(var i = 0; i < arr.length; i++) { res += String.fromCharCode(arr[i]); } But numbers from