node-fileupload
v1.0.0
Published
A Typescript wrapper of multiples modules I need to handle file upload on my projects.
Downloads
2
Readme
@kazhord/node-fileupload
A Typescript wrapper of multiples modules I need to handle file upload on my projects.
Installation
$ npm install @kazhord/node-fileupload
Features
- Get file type
- Check if file is image
API
import { FileUploadUtils } from '@kazhord/node-fileupload'
Get file type
await FileUploadUtils.getFileTypeFromFile(path)
await FileUploadUtils.getFileTypeFromBuffer(buffer)
await FileUploadUtils.getFileTypeFromStream(stream)
/*
{
ext: 'jpg',
mime: 'image/jpg'
}
*/
Check if image
await FileUploadUtils.isImageFromFile(path)
await FileUploadUtils.isImageFromBuffer(buffer)
await FileUploadUtils.isImageFromStream(stream)
/*
true
*/