Toggle navigation
Toggle navigation
This project
Loading...
Sign in
2020-1-CloudComputing
/
D_Team_Khuloud
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
leeseohyeon
2020-05-31 23:20:01 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
721addc5b4f87a9cb067e6f578352dd59c729d9b
721addc5
1 parent
41d26557
다운로드 수정
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
5 deletions
backend/routes/file/downloadFile.js
backend/routes/modules/awsconfig.json
backend/routes/modules/s3/download/shlee/test100(1).txt
backend/routes/modules/s3/s3.js
backend/routes/file/downloadFile.js
View file @
721addc
...
...
@@ -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
...
...
backend/routes/modules/awsconfig.json
View file @
721addc
{
"accessKeyId"
:
"ASIA
XZL2SWFE22KE6FMR
"
,
"secretAccessKey"
:
"
xicAWumxI045y2H/gpvHj931ejPAxKx05z3s7306
"
,
"sessionToken"
:
"FwoGZXIvYXdzEN
T//////////wEaDMjAgd73D8cgPHM6cCLDARgKnP64irW5N1G56jblgQgjgf58Xwfr/Ysghx6udQ0sS5St5XOtnc/nMqukHOc//gqPaSgNZza57fmaIQVdTM8dgSbM6a72SbXirYO38YDfzHCQz73gg2DWAjrZy2RDu1v8lmshh3393B9MuZFEEJzDgsLgNAmQmP5iULRVqnVqRhUcuhMxFz91nsSuts1u0r41sBZTEwKjE3Qnor3PrUS7KKeZqi8axod4jEwLCDj+CW6N2l5I8QeXtanrKnHGVL4NiiiJlc72BTIt1pHEnchZvLii96Afs5ThV/018vTKHgqZl7m/QGHCVc5hwcNOU6MLnwSLHFYf
"
,
"accessKeyId"
:
"ASIA
ZQ5XTMMFRYMR3VRB
"
,
"secretAccessKey"
:
"
XG8dCozEdASwBXDpdDLoXHXRzXwdaUoZ7Iclpnn7
"
,
"sessionToken"
:
"FwoGZXIvYXdzEN
f//////////wEaDI+1QF+djlC4HKhgXSLDASLQ79zowPQb14gxxDVD3Due4qV58b2E7S7b2fus/4oOaF3B1+EnZ5ofHKEL3vBnlmzg7Oo37VlbzWh0Ik3QS6XRLg5tf7JxZqZyHhGx0/1k7f6BCZZuoVSBgyEBvGs4VJDZkmWNXv+MT9ytHyl/L1hhuiwqEWFoHJKMwO5jS9QieGJtUl9BP4YKrA1WamiqPZnIkb9TbbNk47Ud8bady5TBO/3u0bBBGL4wkGtAGHPeGSKNy6Ea6gIb9lzpagDN8AKCnSjd5s72BTItHPfO4igQfm5Bl277gKZLytgfzWe4iSPHh4BjmaNVK61zP0zS5wGfD7mcE+X6
"
,
"region"
:
"us-east-1"
}
...
...
backend/routes/modules/s3/download/shlee/test100(1).txt
View file @
721addc
[object Object]
\ No newline at end of file
backend/routes/modules/s3/s3.js
View file @
721addc
...
...
@@ -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'
);
...
...
Please
register
or
login
to post a comment