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

fileTypeFromFile are not defined in browser.d.ts #640

Closed
hrynevychroman opened this issue Jul 10, 2024 · 1 comment · Fixed by #641
Closed

fileTypeFromFile are not defined in browser.d.ts #640

hrynevychroman opened this issue Jul 10, 2024 · 1 comment · Fixed by #641
Assignees
Labels

Comments

@hrynevychroman
Copy link

Why I can't use this function inside my front-end app to define what mime type is file?

image
@Borewit
Copy link
Collaborator

Borewit commented Jul 10, 2024

Because fileTypeFromFile is used to access files on you local file system, which is only possible via Node.js file sytem API.

If you want to read a File (a File you uploaded in a browser environment), you can use fileTypeFromBlob(blob).

This could be better documented in the README, please keep this issue open until that is clearly captured.

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

Successfully merging a pull request may close this issue.

2 participants