Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
a384a6ac0a | |||
080abb0138 |
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@push.rocks/smartmime",
|
||||
"version": "2.0.0",
|
||||
"version": "2.0.1",
|
||||
"private": false,
|
||||
"description": "A module for detecting MIME types with support for binary and text file distinctions.",
|
||||
"main": "dist_ts/index.js",
|
||||
|
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/smartmime',
|
||||
version: '2.0.0',
|
||||
version: '2.0.1',
|
||||
description: 'A module for detecting MIME types with support for binary and text file distinctions.'
|
||||
}
|
||||
|
@ -39,3 +39,11 @@ export const getEncoding = async (optionsArg: {
|
||||
}) => {
|
||||
return (await isBinary(optionsArg)) ? 'binary' : 'utf8';
|
||||
};
|
||||
|
||||
/**
|
||||
* Synchronous version to get encoding based on the file extension
|
||||
*/
|
||||
export const getPathEncodingSync = (path: string): 'binary' | 'utf8' => {
|
||||
const mimeType = plugins.mime.getType(path);
|
||||
return binaryMimeTypes.includes(mimeType) ? 'binary' : 'utf8';
|
||||
};
|
Reference in New Issue
Block a user