leeseohyeon

다운로드 수정

......@@ -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": "ASIAXZL2SWFE22KE6FMR",
"secretAccessKey": "xicAWumxI045y2H/gpvHj931ejPAxKx05z3s7306",
"sessionToken": "FwoGZXIvYXdzENT//////////wEaDMjAgd73D8cgPHM6cCLDARgKnP64irW5N1G56jblgQgjgf58Xwfr/Ysghx6udQ0sS5St5XOtnc/nMqukHOc//gqPaSgNZza57fmaIQVdTM8dgSbM6a72SbXirYO38YDfzHCQz73gg2DWAjrZy2RDu1v8lmshh3393B9MuZFEEJzDgsLgNAmQmP5iULRVqnVqRhUcuhMxFz91nsSuts1u0r41sBZTEwKjE3Qnor3PrUS7KKeZqi8axod4jEwLCDj+CW6N2l5I8QeXtanrKnHGVL4NiiiJlc72BTIt1pHEnchZvLii96Afs5ThV/018vTKHgqZl7m/QGHCVc5hwcNOU6MLnwSLHFYf",
"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');
......