feathersjs-ecosystem / feathers-blob

Feathers service for blob storage, like S3.

Home Page:http://feathersjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unsupported mime types

alisamar opened this issue · comments

commented

Following mime types does not mapped from mime-type module.

'application/gzip'
'application/x-gzip'

So,mimeTypes.extension(contentType) return to false; (https://github.com/feathersjs/feathers-blob/blob/master/src/index.js#L51)

my-iso.tar.gz or my-iso.tgz files saved as follows:
400414b1bc866859d49190883e6886698fa14ab77d7d58df35534d6d8f94bde8.false

Is it possible to add custom mime/extension mappings ?

Looking at the mime-types module you should be able to add you own extensions to therequire('mime-types').extensions object.

commented

Hey David,

Thanks for the tip, following code solved the issue:

var custom = {
    'application/gzip': ['gz'],
    'application/x-gzip': ['tar.gz','tgz','gz'],
};

Object.assign(require('mime-types').extensions, custom);

Awesome. I'm going to close this then.