aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGirish Ramakrishnan <girish@forwardbias.in>2015-11-27 15:01:36 -0800
committerGirish Ramakrishnan <girish@forwardbias.in>2015-11-27 15:05:17 -0800
commit0f5a7ba229422f25a65e07d65b4768b9ad455a12 (patch)
treeab2e18c7825e408579d799f41f7ffc80e1140db7
parent0e8695d7e01c30caac1ec79469ae5d53671a187e (diff)
downloadSurfer-0f5a7ba229422f25a65e07d65b4768b9ad455a12.tar.gz
Surfer-0f5a7ba229422f25a65e07d65b4768b9ad455a12.tar.zst
Surfer-0f5a7ba229422f25a65e07d65b4768b9ad455a12.zip
Display uploaded URL
-rw-r--r--cli/actions.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/cli/actions.js b/cli/actions.js
index 7767281..e5b0c6d 100644
--- a/cli/actions.js
+++ b/cli/actions.js
@@ -94,10 +94,15 @@ function put(filePath, otherFilePaths, options) {
94 94
95 async.eachSeries(files, function (file, callback) { 95 async.eachSeries(files, function (file, callback) {
96 var relativeFilePath = path.resolve(file).slice(process.cwd().length + 1); 96 var relativeFilePath = path.resolve(file).slice(process.cwd().length + 1);
97 var destinationPath = (options.destination ? '/' + options.destination : '') + '/' + relativeFilePath;
98 console.log('Uploading file %s -> %s', relativeFilePath.cyan, destinationPath.cyan);
97 99
98 console.log('Uploading file %s -> %s', relativeFilePath.cyan, ((options.destination ? options.destination : '') + '/' + relativeFilePath).cyan); 100 superagent.put(config.server() + API + relativeFilePath).query(gQuery).attach('file', file).end(function (error, result) {
101 if (error) return callback(error);
102 if (result.statusCode !== 201) return callback(new Error('Error uploading file: ' + result.statusCode));
99 103
100 superagent.put(config.server() + API + relativeFilePath).query(gQuery).attach('file', file).end(callback); 104 console.log('Uploaded to ' + config.server() + destinationPath);
105 });
101 }, function (error) { 106 }, function (error) {
102 if (error) { 107 if (error) {
103 console.log('Failed to put file.', error); 108 console.log('Failed to put file.', error);