Add loader and new formats
Some checks failed
Bump deps (only minor versions) / ci (push) Failing after 11s
Some checks failed
Bump deps (only minor versions) / ci (push) Failing after 11s
This commit is contained in:
parent
204bceeee3
commit
dcb7cfec27
6 changed files with 148 additions and 40 deletions
14
src/lib/server/helpers.ts
Normal file
14
src/lib/server/helpers.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import formats from '$lib/common/supportedFormats.json';
|
||||
|
||||
const formatMime = new Map(Object.entries(formats))
|
||||
|
||||
export const mimeTypeMap = formatMime;
|
||||
export const contentTypeFromFormat = (format: string): string => {
|
||||
const toReturn: string | undefined = formatMime.get(format)
|
||||
|
||||
if (!toReturn) {
|
||||
throw new Error("Unsupported format")
|
||||
}
|
||||
|
||||
return toReturn;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue