Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for other extensions except CSV for uploaded files #79

Open
2 tasks
kmanaseryan opened this issue Sep 11, 2020 · 5 comments
Open
2 tasks

Add support for other extensions except CSV for uploaded files #79

kmanaseryan opened this issue Sep 11, 2020 · 5 comments
Assignees

Comments

@kmanaseryan
Copy link
Member

Currently in the calls dedicated for uploaded files the csv format is hardcoded. We need to make it so the format will be automatically generated from the mime type.

Acceptance criteria

  • If I pass anything than CSV file the format should be the appropriate extension

Tasks

  • Read mime type from the file and generate the format
@kmanaseryan kmanaseryan self-assigned this Sep 11, 2020
@anuveyatsu
Copy link
Member

Here is another fix for this - db55e8c which uses file extension to detect file format. I'm not sure if using mimetype is a good idea.

@anuveyatsu
Copy link
Member

@kmanaseryan Please, feel free to close this issue as fixed if you believe so.

@kmanaseryan
Copy link
Member Author

@anuveyatsu there is lib which does job for us: https://www.npmjs.com/package/mime-types. If the extensions are known and they are few, we can actually hardcode them in a list and get the format from there, but if they are going to be arbitrary extensions then I think it worth to use the lib.

@anuveyatsu
Copy link
Member

@kmanaseryan yes and we're actually using that lib already https://github.com/datopian/data.js/blob/master/package.json#L53 and https://github.com/datopian/data.js/blob/b03836de6b3291173d2c37901456ba5f5aeb2baf/src/index.js#L369

I'm not sure about that lib because it might be just mapping file extension to mime-type.

@kmanaseryan
Copy link
Member Author

@anuveyatsu cool, haven't noticed that, so we can use it then.

I'm not sure about that lib because it might be just mapping file extension to mime-type.

I think the lib is more safe than we do it on ourselves, becuase two different mime types can have one extension, so this lib I believe handles that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants