Skip to content

v0.0.2

Latest
Compare
Choose a tag to compare
@Brooooooklyn Brooooooklyn released this 24 Apr 08:26
· 1 commit to main since this release
v0.0.2
300944b

Usage

import { readFile } from 'node:fs'

import { FileType } from '@toeverything/file-type'

const fileType = new FileType(await readFile('path/to/file.jpg'))
console.log(fileType.mime()) // 'application/image/jpeg'
console.log(fileType.ext()) // 'jpg'

Performance

┌─────────┬───────────────────────────┬─────────────┬────────────────────┬──────────┬─────────┐
│ (index) │ Task Name                 │ ops/sec     │ Average Time (ns)  │ Margin   │ Samples │
├─────────┼───────────────────────────┼─────────────┼────────────────────┼──────────┼─────────┤
│ 0       │ '@toeverything/file-type' │ '1,554,666' │ 643.2246344556239  │ '±2.01%' │ 777334  │
│ 1       │ 'file-type'               │ '664,314'   │ 1505.3104426207442 │ '±0.38%' │ 332158  │
└─────────┴───────────────────────────┴─────────────┴────────────────────┴──────────┴─────────┘

Full Changelog: v0.0.1...v0.0.2