corrected error with reading negative bytes
This commit is contained in:
@@ -7,6 +7,7 @@ const exec = require('child_process').exec;
|
||||
|
||||
function loadBin(httpContent, response) {
|
||||
|
||||
console.log(httpContent.length);
|
||||
var uploadClass = main.protoConstructor.Upload;
|
||||
var uploadObject = uploadClass.decode(httpContent);
|
||||
fs.writeFile(main.binFilePath, uploadObject.data.buffer, "binary", function (error) {
|
||||
|
||||
@@ -9,11 +9,12 @@ function start(route, handlers) {
|
||||
var pathname = url.parse(request.url).pathname;
|
||||
var httpContent = [];
|
||||
request.on("data", function (datas) {
|
||||
var strDatas = datas.toString();
|
||||
for (var i = 0; i < datas.length; ++i) {
|
||||
httpContent.push(strDatas.charCodeAt(i));
|
||||
for (var i = 0; i < datas.length; i++) {
|
||||
// httpContent.push(strDatas.charCodeAt(i));
|
||||
httpContent.push(datas[i]);
|
||||
}
|
||||
});
|
||||
|
||||
request.on("end", function () {
|
||||
route(handlers, pathname, httpContent, response);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user