Remove sftp uploading

This commit is contained in:
Jonathan Cremin 2016-08-07 11:34:45 +01:00
parent 695644c260
commit f6ba817a26
4 changed files with 2 additions and 17 deletions

View file

@ -25,7 +25,6 @@ export function* post(next) {
uploader.processingEvent();
yield uploader.sendToSFTP();
yield uploader.processImage();
yield uploader.finalise();

View file

@ -1,7 +1,6 @@
import fs from 'fs';
import createError from 'http-errors';
import { get as getSFTP } from './sftp';
import { get as getS3 } from './s3';
import debugname from 'debug';
const debug = debugname('hostr:file-stream');
@ -35,12 +34,6 @@ export default function hostrFileStream(localPath, remotePath) {
.then(resolve)
.catch((err) => {
debug('not on sftp', err);
writer(localPath, getS3(remotePath))
.then(resolve)
.catch((s3err) => {
debug('not on s3');
reject(s3err);
});
});
});
localRead.once('readable', () => {

View file

@ -9,7 +9,6 @@ import hostrId from './hostr-id';
import resize from './resize';
import malware from './malware';
import { sniff } from './type';
import { upload as sftpUpload } from './sftp';
import debugname from 'debug';
const debug = debugname('hostr-api:uploader');
@ -96,10 +95,6 @@ export default class Uploader {
this.upload.resume();
}
sendToSFTP() {
return sftpUpload(join(storePath, this.path), join('hostr', 'uploads', this.path));
}
acceptedEvent() {
const acceptedEvent = `{"type": "file-accepted", "data":
{"id": "${this.id}", "guid": "${this.tempGuid}", "href": "${baseURL}/${this.id}"}}`;
@ -190,10 +185,7 @@ export default class Uploader {
const path = join(this.id[0], String(newSize.width), `${this.id}_${this.filename}`);
debug('Writing file');
debug(join(storePath, path));
return fs.writeFile(join(storePath, path), image).then(() => {
debug('Uploading file');
return sftpUpload(join(storePath, path), join('hostr', 'uploads', path));
}).catch(debug);
return fs.writeFile(join(storePath, path), image).catch(debug);
}).catch(debug);
}

View file

@ -64,6 +64,7 @@
"lwip": "0.0.9",
"mime-types": "~2.1.5",
"moment": "^2.13.0",
"mongodb": "^2.2.5",
"mongodb-promisified": "~1.0.3",
"mz": "^2.4.0",
"node-fetch": "^1.5.3",