-
-
Notifications
You must be signed in to change notification settings - Fork 343
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
Browser compatibility questions #354
Comments
Unless my questions is out of scope of this development effort and this library is not supposed to target client-side javascript at all 😁 Edit: I've found an issue that has a similar question. Unfortunately not all client-side libraries want to transpile third-party dependencies. I agree with the approach, since it's not really up to me to maintain those. See issue here: angular/angular-cli#9214. But again, this could fall out of scope and I'd understand if it's not planned to be made available. |
This comment angular/angular-cli#9214 (comment) sums it up pretty well. It's up to you to transpile. If Angular makes this difficult, it's a problem for Angular to solve. As for usage without needing |
Sorry for a stupid question, but I saw the @mizvyt have you managed to make it work? I have a similar issue, but in my case polyfill Thanks in advance for any help or advice. |
Although this module is primary designed for Node.js, using it in the browser is possible as well. That is indeed where 'file-type/browser' intended for. It provides the right dependencies and right functions to the JavaScript module bundler. Some dependencies, which are typically present in a Node.js environment, but are missing in a browser environment, you may need to pass (polyfill) to your module bundler. Although in some cases it may a bit tricky to configure it, note that this is a pretty common task handled by a module bundler. In the dependents you should be able to find other projects running file type in the browser. |
I'm importing directly from
|
@Borewit @mizvyt thank you both for your help and quick response. After some time I gave up using
|
Hi, a very useful library, thanks a lot for the effort.
I am using this in an Angular application like such:
Also using an additional polyfill for
Buffer
type, as it's not a natively available on a browser:I was essentially looking for a way to be able to determine a MIME type of a file on the client side. It seems to work perfectly on all modern browsers, but on Edge it seems to fail to load this library because of this tiny line of code below:
file-type/core.js
Line 41 in abc699a
This is ES6 syntax, which is not supported in Edge or any IE browsers.
Two questions:
Buffer
class and use something likeArrayBuffer
instead? (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)The text was updated successfully, but these errors were encountered: