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
박기범
2020-05-31 23:45:34 +0900
Browse Files
Options
Browse Files
Download
Plain Diff
Commit
376d58de2fd563ed095eb977733285e602d1ca79
376d58de
2 parents
2acff414
721addc5
modify downloadFile.js
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 @
376d58d
...
...
@@ -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 @
376d58d
{
"accessKeyId"
:
"ASIA
XZL2SWFE2G3JPNJM
"
,
"secretAccessKey"
:
"
9Dh2Dj45wFtHm4Lg/nbgbN42OQiS61Hml9dPn+6I
"
,
"sessionToken"
:
"FwoGZXIvYXdzENf//////////wEaD
FGMdv4aiBTMpEJSdyLDAbrZTnHBLLwLlUfaMxk1ViuyxhqbC8KfJhfXHai44mqPufTXytHekQhXmIyv3nkQ9GsSRkhZ1sZ9hhXUymGSCctzYoPvz8hUMD7IJIbsJlhl55comcsYZBIOljSZKvK5pdPuEaqkT40ilZBsYi6+KAd/OASfjfw5k71dwcujNMF+f6JFmA2o8aKXMwu3j8iYA8by2vmPLdr2g2domjqcCDaTl6kYkjc2JCvWrCOquHw53qYMERkFzO+67ulq1dxEU4xp0yjh7c72BTItHXHt57ZKmztt45KViYlzK30tFYKTQIXNu6TE2FpoxlICRGWGajDyOuhHGkw9
"
,
"accessKeyId"
:
"ASIA
ZQ5XTMMFRYMR3VRB
"
,
"secretAccessKey"
:
"
XG8dCozEdASwBXDpdDLoXHXRzXwdaUoZ7Iclpnn7
"
,
"sessionToken"
:
"FwoGZXIvYXdzENf//////////wEaD
I+1QF+djlC4HKhgXSLDASLQ79zowPQb14gxxDVD3Due4qV58b2E7S7b2fus/4oOaF3B1+EnZ5ofHKEL3vBnlmzg7Oo37VlbzWh0Ik3QS6XRLg5tf7JxZqZyHhGx0/1k7f6BCZZuoVSBgyEBvGs4VJDZkmWNXv+MT9ytHyl/L1hhuiwqEWFoHJKMwO5jS9QieGJtUl9BP4YKrA1WamiqPZnIkb9TbbNk47Ud8bady5TBO/3u0bBBGL4wkGtAGHPeGSKNy6Ea6gIb9lzpagDN8AKCnSjd5s72BTItHPfO4igQfm5Bl277gKZLytgfzWe4iSPHh4BjmaNVK61zP0zS5wGfD7mcE+X6
"
,
"region"
:
"us-east-1"
}
...
...
backend/routes/modules/s3/download/shlee/test100(1).txt
View file @
376d58d
[object Object]
\ No newline at end of file
backend/routes/modules/s3/s3.js
View file @
376d58d
...
...
@@ -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