2.0.0 • Published 12 months ago

filevalidator v2.0.0

Weekly downloads
307
License
MIT
Repository
-
Last release
12 months ago

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);
    });
});
2.0.0

12 months ago

1.0.1

7 years ago

1.0.0

8 years ago