-
-
Notifications
You must be signed in to change notification settings - Fork 319
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
Allow multiple instances of MIME types container #27
Comments
Hi Alexei, I'm not sure how elegant this is, but we could do something like this:
Then to create a custom instance, just instantiate the constructor, like so:
Thoughts? |
Hi, Thanks for quick response. I thought about something really similar: function Mime() {
// ...
}
Mime.prototype.lookup = function () {
// ...
};
// ... other prototype methods
// Create, load, and export the default instance
var mime = new Mime();
mime.load(... 'mime.types');
mime.load(... 'node.types'); So it's in fact identical to with only difference - export Mime constructor as Mime property of exported module, so to create a custom instance it would be: var myMime = new (require('mime').Mime);
// ... So it will look really similar to standard modules like EventEmitter etc. |
Hi,
Is it possible to add subj? If so I could prepare a pull request. The idea is to have default, filled in mime instance and provide a class that could be used to have absolutely own non-defaults mime types object something like this:
https://github.com/nodeca/static-lulz/blob/master/lib/static_lulz/mime.js
.The text was updated successfully, but these errors were encountered: