From c237133e3008952e18aecfa9cadf1ca87d07693e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franc=CC=A7ois=20Hodierne?= Date: Wed, 2 Jan 2019 22:31:44 +0100 Subject: [PATCH] fix: send file as string from memory, no streaming from disk --- server/controllers/images.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/controllers/images.js b/server/controllers/images.js index df7509c08c7..02c7e856aec 100644 --- a/server/controllers/images.js +++ b/server/controllers/images.js @@ -1,6 +1,6 @@ -import fs from 'fs'; import path from 'path'; import uuidv1 from 'uuid/v1'; + import errors from '../lib/errors'; import knox from '../gateways/knox'; @@ -53,12 +53,12 @@ export default function uploadImage(req, res, next) { req.setTimeout(IMAGE_UPLOAD_TIMEOUT); - fs.createReadStream(file.path).pipe(put); - put.on('response', response => { res.send({ status: response.statusCode, url: put.url, }); }); + + put.end(file.buffer.toString()); }