deno-infer
v1.0.8
Published
Infer file and MIME type
Downloads
1
Readme
Infer (deno-wasm)
Deno wasm bindings to https://github.com/bojand/infer
https://www.npmjs.com/package/deno-infer
Should work with node as well
Usage
import * as infer from "npm:deno-infer";
const file = Deno.readFileSync("filePath");
const type = infer.get(file);
// or this convinient method that reads only the start of the file
// const type = infer.getFromPath(file); // requires Deno 1.37.3 if used from npm
console.log(type.extension());
console.log(type.matcherType());
console.log(type.mimeType());