validate-file-extension-mime-switch
v0.1.3
Published
Package to validating file extension, file mime type based on their buffer.
Downloads
4
Maintainers
Readme
Package validate-file-extension-mime-switch
Description
Package to validating file extension, file mime type based on their buffer.
How to Use
Install package with npm, yarn, etc
npm i validate-file-extension-mime-switch
yarn add validate-file-extension-mime-switch
Create an instance, set fileExtension, set fileMimeType, set fileBuffer, and the get validation result
import { readFileSync } from "fs";
import ValidateFile from "validate-file-extension-mime-switch";
console.time("validate");
const test1 = new ValidateFile()
.setExtension("mp3")
.setMimeType("audio/mpeg")
.setFileBuffer(readFileSync(process.cwd() + "/data/myFavMusic.mp3"))
.validate();
console.timeEnd("validate");
console.log(test1);