Skip to content

Commit

Permalink
fix: send file as string from memory, no streaming from disk
Browse files Browse the repository at this point in the history
  • Loading branch information
znarf committed Jan 3, 2019
1 parent 43d6355 commit c237133
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions server/controllers/images.js
Original file line number Diff line number Diff line change
@@ -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';

Expand Down Expand Up @@ -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());
}

0 comments on commit c237133

Please sign in to comment.