🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

filevalidator

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

filevalidator

File signature validation in JavaScript

2.0.0
latest
Version published
Weekly downloads
960
88.24%
Maintainers
0
Weekly downloads
 
Created

filevalidator.js

File signature validation in JavaScript

Useful for cases where looking at a filename extension only is not reliable enough.

Usage:

import { verifyFileType } from 'filevalidator';

const fileInput = document.getElementById('file-input');

fileInput.addEventListener('change', function(e) {
    const file = e.currentTarget.files[0];
    verifyFileType(file, ['mp3', 'wav'], function(valid) {
        alert('Valid mp3 or wave file: ' + !!valid);
    });
});

FAQs

Package last updated on 15 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts