박기범

modify downloadFile.js

......@@ -9,6 +9,24 @@ var S3 = require('../modules/s3/s3');
router.get('/:name', function (req, res) {
var file_name = req.params.name;
var curPath = req.query.cur; // /folder1/folder2/
var user_id = req.query.id;
var targetFile = curPath.substring(1) + file_name; // folder1/folder2/test.txt
S3.downloadFile3(S3.BUCKET_NAME, user_id, targetFile, function (result, downloadDir) {
if (result) {
res.send({ src: downloadDir })
}else{
res.send({ err: 'download error'})
}
})
});
/*
router.get('/:name', function (req, res, next) {
var file_name = req.params.name; // test.txt
var user_id = req.query.id;
......@@ -26,6 +44,7 @@ router.get('/:name', function (req, res, next) {
var fileStream = s3.getObject(params).createReadStream();
fileStream.pipe(res);
});
*/
/*
// /file/download/:name
......
{
"accessKeyId": "ASIAXZL2SWFE2G3JPNJM",
"secretAccessKey": "9Dh2Dj45wFtHm4Lg/nbgbN42OQiS61Hml9dPn+6I",
"sessionToken": "FwoGZXIvYXdzENf//////////wEaDFGMdv4aiBTMpEJSdyLDAbrZTnHBLLwLlUfaMxk1ViuyxhqbC8KfJhfXHai44mqPufTXytHekQhXmIyv3nkQ9GsSRkhZ1sZ9hhXUymGSCctzYoPvz8hUMD7IJIbsJlhl55comcsYZBIOljSZKvK5pdPuEaqkT40ilZBsYi6+KAd/OASfjfw5k71dwcujNMF+f6JFmA2o8aKXMwu3j8iYA8by2vmPLdr2g2domjqcCDaTl6kYkjc2JCvWrCOquHw53qYMERkFzO+67ulq1dxEU4xp0yjh7c72BTItHXHt57ZKmztt45KViYlzK30tFYKTQIXNu6TE2FpoxlICRGWGajDyOuhHGkw9",
"accessKeyId": "ASIAZQ5XTMMFRYMR3VRB",
"secretAccessKey": "XG8dCozEdASwBXDpdDLoXHXRzXwdaUoZ7Iclpnn7",
"sessionToken": "FwoGZXIvYXdzENf//////////wEaDI+1QF+djlC4HKhgXSLDASLQ79zowPQb14gxxDVD3Due4qV58b2E7S7b2fus/4oOaF3B1+EnZ5ofHKEL3vBnlmzg7Oo37VlbzWh0Ik3QS6XRLg5tf7JxZqZyHhGx0/1k7f6BCZZuoVSBgyEBvGs4VJDZkmWNXv+MT9ytHyl/L1hhuiwqEWFoHJKMwO5jS9QieGJtUl9BP4YKrA1WamiqPZnIkb9TbbNk47Ud8bady5TBO/3u0bBBGL4wkGtAGHPeGSKNy6Ea6gIb9lzpagDN8AKCnSjd5s72BTItHPfO4igQfm5Bl277gKZLytgfzWe4iSPHh4BjmaNVK61zP0zS5wGfD7mcE+X6",
"region": "us-east-1"
}
......
......@@ -17,7 +17,7 @@
var AWS = require('aws-sdk');
AWS.config.update({ region: 'ap-northeast-2' });
var BUCKET_NAME = 'qkrrlqja-test';
var BUCKET_NAME = 'dkhuloud';
var s3 = new AWS.S3();
var fs = require('fs');
......