1.0.1 • Published 2 months ago
@signageos/file v1.0.1
File npm package
Determine type of FILEs.
A simple wrapper over file command available in Linux systems.
Package is supported for Windows (non-linux) as well.
Installation
npm i @signageos/file
Usage
import file from '@signageos/file';
(async function () {
const result = await file('/tmp/file-to-determine');
console.log(result); // { type: ['ASCII text'] }
})();
Interface
function file(filePath: string, options?: Options): Promise<Result>;
interface Options {
fileBinPath?: string; // path to file binary to be used instead of default
mimeType?: boolean; // if set to true, result will contain detected mime-type of file. Default false.
separator?: string; // default ':'
alternativeSeparators?: string[]; // default [';', '$', '€', '>', '<']
}
interface Result {
mimeType?: string; // detected mime-type of file (if option mimeType set to true)
charset?: string; // detect charset of file (if option mimeType set to true)
types?: string[]; // get all detected general types (if no mimeType set)
}
Get version of file
import { getVersion } from '@signageos/file';
(async function () {
const version = await getVersion();
console.log(version); // file-5.32
})();
Limitations
Currently only following features are supported:
- type: Returns default type of given file (without arguments)
- mimeType: Returns detected mime-type of given file.
References
License
- MIT
1.0.1
2 months ago
1.0.0
2 months ago
1.0.0-main.68
3 months ago
1.0.0-main.65
3 months ago
0.1.2-dependabot-npm-and-yarn-ts-node-10-9-2.45
6 months ago
1.0.0-mikulas-dependency-update.59
3 months ago
0.1.2-dependabot-npm-and-yarn-depcheck-1-4-7.43
6 months ago
1.0.0-mikulas-dependency-update.63
3 months ago
1.0.0-mikulas-dependency-update.64
3 months ago
0.1.2-dependabot-npm-and-yarn-debug-4-3-1.42
6 months ago
1.0.0-mikulas-dependency-update.60
3 months ago
1.0.0-mikulas-todos-and-doc.66
3 months ago
1.0.0-mikulas-todos-and-doc.67
3 months ago
0.1.2-mikulas-dependency-update.58
3 months ago
0.1.2-mikulas-dependency-update.57
3 months ago
0.1.2-jk-fix-node-18.27
2 years ago
0.1.2-main.24
3 years ago
0.1.1-main.21
4 years ago
0.1.1-main.17
4 years ago
0.1.1-mz-win32-fix.18
4 years ago
0.1.1
4 years ago
0.1.1-mz-win32-fix.19
4 years ago
0.1.1-mz-win32-fix.20
4 years ago
0.1.1-mz-newer-win32-file.16
5 years ago
0.1.0
5 years ago
0.1.0-main.13
5 years ago
0.1.0-main.12
5 years ago
0.1.0-main.11
5 years ago
0.1.0-main.9
5 years ago
0.1.0-main.8
5 years ago