Remove sftp uploading
This commit is contained in:
parent
695644c260
commit
f6ba817a26
4 changed files with 2 additions and 17 deletions
|
@ -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', () => {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue