I don't know how to use it, even though I had research but it still not work
fs.rename(tmpFile, nFile, function(){
var stream = fs.createReadStream(nFile);
var req = knoxClient.putStream(stream, fName, {
'Content-type': 'image/jpeg',
'Content-Length': fSize
}, function(err, results){
console.log(results);
});
req.on('response', function(resX){
if(resX.statusCode == 200){
console.log("Pushed Success!!!!!!!!");
res.writeHead(200, {'Content-type': 'text/plain'});
res.end(JSON.stringify({"FileName": fName}));
}else{
var err = new Error("Error" + resX.statusCode);
err.status = resX.statusCode;
next(err);
}
});
});
Lastly, use gm(or im) before createReadStream or after ?
There is an example on knox documentation