{"id":19081086,"url":"https://github.com/suryakant2000/generic-file-validator","last_synced_at":"2026-05-13T20:35:03.103Z","repository":{"id":181291435,"uuid":"666514030","full_name":"suryakant2000/generic-file-validator","owner":"suryakant2000","description":"NPM package, for validating the file MIME type.","archived":false,"fork":false,"pushed_at":"2023-07-31T18:50:38.000Z","size":29,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-11-24T04:06:21.937Z","etag":null,"topics":["filevalidator","mime-type","npm-package"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/generic-file-validator?activeTab=readme","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/suryakant2000.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-07-14T18:04:23.000Z","updated_at":"2023-07-29T10:32:28.000Z","dependencies_parsed_at":"2025-10-29T02:41:28.874Z","dependency_job_id":"c41640da-47f9-44b8-8d1b-ce500c488b1d","html_url":"https://github.com/suryakant2000/generic-file-validator","commit_stats":null,"previous_names":["suryakant2000/file-validator","suryakant2000/generic-file-validator"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/suryakant2000/generic-file-validator","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suryakant2000%2Fgeneric-file-validator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suryakant2000%2Fgeneric-file-validator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suryakant2000%2Fgeneric-file-validator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suryakant2000%2Fgeneric-file-validator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/suryakant2000","download_url":"https://codeload.github.com/suryakant2000/generic-file-validator/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suryakant2000%2Fgeneric-file-validator/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32999515,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"ssl_error","status_checked_at":"2026-05-13T13:14:51.610Z","response_time":115,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["filevalidator","mime-type","npm-package"],"created_at":"2024-11-09T02:32:59.391Z","updated_at":"2026-05-13T20:35:03.048Z","avatar_url":"https://github.com/suryakant2000.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# generic-file-validator\n\n### What it does?\nIt checks the file MIME type, and validate it against the extension.\n\n### Install\n```\nnpm i generic-file-validator\n```\n\n### Supported media and extension\n| Media  | Extension |\n| ------------- | ------------- |\n| image  | .jpg, .jpeg, .png, .gif, .webp, .tiff, .bmp  |\n| audio  | .mp3, .oga, .wav, .mid, .midi  |\n| video  | .mp4, .ogv, .avi, .mpeg, .webm, .mkv, .3gp  |\n| application  | .doc, .docx, .xls, .xlsx, .ppt, .pptx, .zip, .apk, .pdf  |\n\n\u003cbr\u003e\n\n## User guide\n\n### Props\n| Props name | Description | Defalut value | Required | Example |\n| ------------- | ------------- | ------------- | ------------- | ------------- |\n| file   | The file which you want to validate     | null    | true | file: file to be validated |\n| media     |  The media type, it will whitelist all the supported extension       | []      | required if 'whitelistExtension' is not passed in the function | media: ['image']\n| whitelistExtension   | The extension you want to whitelist irrespective of media     | []    | required if 'media' is not passed in the function | whitelistExtension: ['png', 'gif'] |\n| blacklistExtension   | The extension you want to blacklist irrespective of media     | []    | false | blacklistExtension: ['tiff', 'pdf'] |\n| returnBase64   | Return base64 of the file     | true    | false | returnBase64: false |\n\n### Usage\nHere is the example usage in react app.\n```\nimport \"./App.css\";\nimport fileValidator from \"generic-file-validator\";\n\nfunction App() {\n  const handleChange = (e) =\u003e {\n    let file = e.target.files[0];\n\n    fileValidator(\n      {\n        file: file,\n        media: [\"image\"],\n        whitelistExtension: [\"jpg\", \"jpeg\"],\n        blacklistExtension: [\"png\"],\n      },\n      callback\n    );\n  };\n\n  const callback = (res) =\u003e {\n    console.log({ res });\n  };\n\n  return (\n    \u003cdiv className=\"App\"\u003e\n      \u003cinput type=\"file\" onChange={handleChange} /\u003e\n    \u003c/div\u003e\n  );\n}\n\nexport default App;\n```\n### Usefull Link\nhttps://codesandbox.io/s/generic-file-validator-example-zjlyrm\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuryakant2000%2Fgeneric-file-validator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuryakant2000%2Fgeneric-file-validator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuryakant2000%2Fgeneric-file-validator/lists"}