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

refactor: remove mime-types / mime-db dependency #2152

Closed
ddelgrosso1 opened this issue Feb 16, 2023 · 2 comments · Fixed by #2435
Closed

refactor: remove mime-types / mime-db dependency #2152

ddelgrosso1 opened this issue Feb 16, 2023 · 2 comments · Fixed by #2435
Assignees
Labels
api: storage Issues related to the googleapis/nodejs-storage API. next major: breaking change this is a change that we should wait to bundle into the next major version type: cleanup An internal cleanup or hygiene concern.

Comments

@ddelgrosso1
Copy link
Contributor

Currently we utilize mime to detect content types and set metadata accordingly. Mime uses mime-db which is essentially a lookup table from JSON files. This dependency is accounting for ~13% of our package size. We should remove this dependency in favor of something smaller for example we could write a MIME sniffer based on the spec if one does not already exist for Node.

@ddelgrosso1 ddelgrosso1 added type: cleanup An internal cleanup or hygiene concern. priority: p3 Desirable enhancement or fix. May not be included in next release. next major: breaking change this is a change that we should wait to bundle into the next major version labels Feb 16, 2023
@product-auto-label product-auto-label bot added the api: storage Issues related to the googleapis/nodejs-storage API. label Feb 16, 2023
@ddelgrosso1 ddelgrosso1 removed the priority: p3 Desirable enhancement or fix. May not be included in next release. label Jul 13, 2023
@ddelgrosso1
Copy link
Contributor Author

ddelgrosso1 commented Apr 4, 2024

Circling back as I noticed we are using two libraries that essentially do the same thing.

"mime": "^3.0.0",

and

"mime-types": "^2.0.8",

At the very least we should remove one (probably mime-types as it is the one requiring mime-db) and just use mime. I'm not sure if this would be a breaking change as it would difficult to test every mime type permutation.

@ddelgrosso1 ddelgrosso1 changed the title refactor: remove mime / mime-db dependency refactor: remove mime-types / mime-db dependency Apr 4, 2024
@ddelgrosso1 ddelgrosso1 self-assigned this Apr 4, 2024
@ddelgrosso1
Copy link
Contributor Author

After more investigation I don't believe the removal of mime-types to be breaking. All of the additional types supported by mime-db appear to be extension-less which means they would be of no use in setting the content type based on a file extension.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the googleapis/nodejs-storage API. next major: breaking change this is a change that we should wait to bundle into the next major version type: cleanup An internal cleanup or hygiene concern.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant