diff --git a/lib/utils.js b/lib/utils.js deleted file mode 100644 index 270cbd6a2..000000000 --- a/lib/utils.js +++ /dev/null @@ -1,27 +0,0 @@ -'use strict' - -exports.isSQLite = function isSQLite (sequelize) { - return sequelize.options.dialect === 'sqlite' -} - -exports.getImageMimeType = function getImageMimeType (imagePath) { - var fileExtension = /[^.]+$/.exec(imagePath) - - switch (fileExtension[0]) { - case 'bmp': - return 'image/bmp' - case 'gif': - return 'image/gif' - case 'jpg': - case 'jpeg': - return 'image/jpeg' - case 'png': - return 'image/png' - case 'tiff': - return 'image/tiff' - case 'svg': - return 'image/svg+xml' - default: - return undefined - } -} diff --git a/lib/utils.ts b/lib/utils.ts new file mode 100644 index 000000000..58af78618 --- /dev/null +++ b/lib/utils.ts @@ -0,0 +1,30 @@ +export module Utils { + export function isSQLite(sequelize) { + return sequelize.options.dialect === 'sqlite' + } + + export function getImageMimeType(imagePath: string) { + const fileExtension = /[^.]+$/.exec(imagePath) + switch (fileExtension?.[0]) { + case 'bmp': + return 'image/bmp' + case 'gif': + return 'image/gif' + case 'jpg': + case 'jpeg': + return 'image/jpeg' + case 'png': + return 'image/png' + case 'tiff': + return 'image/tiff' + case 'svg': + return 'image/svg+xml' + default: + return undefined + } + } + +} + + +