We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I'd like to use this same lib not only for validation, but determining which type a given file is as well.
function getMimeType(file?: File): { baseType, type } { ... } function validateMimeType(file?: File, acceptedFiles?: string | string[]): boolean { ... const { baseType, type } = getMimeType(file) ... }
const myFile = <a file> if (!validateMimeType(myFile)) { throw new Error('not a valid file type') } if (getMimeType(myFile).baseType === 'image') { // present preview of the image } else { // present a generic file icon }
The text was updated successfully, but these errors were encountered:
@k-funk PRs are welcomed, so go ahead.
Sorry, something went wrong.
No branches or pull requests
I'd like to use this same lib not only for validation, but determining which type a given file is as well.
Signatures
Sample Usage
The text was updated successfully, but these errors were encountered: