У меня есть этот код до сих пор, но не могу получить бинарность Buffer
.Как загрузить файл в node.js с помощью http-модуля?
var http = require('http');
var myServer = http.createServer(function(request, response)
{
var data = '';
request.on('data', function (chunk){
data += chunk;
});
request.on('end',function(){
if(request.headers['content-type'] == 'image/jpg') {
var binary = Buffer.concat(data);
//some file handling would come here if binary would be OK
response.write(binary.size)
response.writeHead(201)
response.end()
}
Но получить эту ошибку: throw new TypeError('Usage: Buffer.concat(list, [length])');
отличный ответ :) –