better file info
This commit is contained in:
parent
80e022fefb
commit
f463e41447
|
@ -517,10 +517,13 @@ function giveconverted(file, bitrate, format)
|
|||
iodata = convert(file, bitrate = bitrate, format = format)
|
||||
headers = Dict{String,String}()
|
||||
suffix = format
|
||||
mime = suffix in keys(Mux.mimetypes) ? Mux.mimetypes[suffix] : suffix
|
||||
mime = suffix in keys(Mux.mimetypes) ? Mux.mimetypes[suffix] :
|
||||
"application/octet-stream"
|
||||
headers["Content-Type"] = mime
|
||||
# headers["Content-Length"] = string(length(data))
|
||||
return Dict(:body => take!(iodata), :headers => headers)
|
||||
return Dict(:body => take!(iodata),
|
||||
:headers => headers,
|
||||
:file => )
|
||||
end
|
||||
|
||||
function convert(infile; bitrate = 64, format = "oga")
|
||||
|
@ -562,10 +565,12 @@ function sendfile(path; suffix = nothing)
|
|||
isfile(path) || return Dict{String,String}(:body => "Not Found")
|
||||
suffix = suffix == nothing ? lowercase(split(path, '.')[end]) : suffix
|
||||
headers = Dict{String,String}()
|
||||
mime = suffix in keys(Mux.mimetypes) ? Mux.mimetypes[suffix] : suffix
|
||||
mime = suffix in keys(Mux.mimetypes) ? Mux.mimetypes[suffix] :
|
||||
"application/octet-stream"
|
||||
headers["Content-Type"] = mime
|
||||
headers["Content-Length"] = string(filesize(path))
|
||||
return Dict(:body => read(path),
|
||||
:file => filename(path),
|
||||
:headers => headers)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue