Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F7860101
uploaded-files.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
748 B
Referenced Files
None
Subscribers
None
uploaded-files.ts
View Options
import
Router
from
"@koa/router"
;
const
uploaded_files
=
new
Router
();
uploaded_files
.
get
(
"/:bucket/:filename"
,
async
(
ctx
)
=>
{
const
filenameParams
=
ctx
.
params
.
filename
;
if
(
!
filenameParams
)
{
throw
Error
(
"filename param is missing"
);
}
const
file
=
await
ctx
.
$app
.
FileManager
.
fromToken
(
ctx
.
$app
.
FileManager
.
encodeToken
(
ctx
.
params
.
bucket
==
"persistent"
,
filenameParams
,
filenameParams
)
);
ctx
.
body
=
file
.
getStream
();
ctx
.
type
=
file
.
mimetype
;
// removing this as it only created trouble and you can declare download
// target in html <a> element, anyway
// ctx.set(
// "Content-Disposition",
// `attachment; filename*=utf-8''="${encodeURIComponent(file.filename)}"`
// );
});
export
default
uploaded_files
;
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Wed, Aug 13, 17:15 (1 d, 8 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
872054
Default Alt Text
uploaded-files.ts (748 B)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment