path2ct v1.0.1
Path to content-type
Get started
The package is available via npm. It has to be installed as a local dependency:
npm install path2ct
It consists of three pure functions which can be used to quickly get file extension or corespondent content type from a path.
API
getContentType: ( path: string) => string | undefinedLookups correct MIME content-type for specified path and return it as a string. If extension can not be identified returns undefined.
getContentTypeMaybe: (path: string) => Maybe<string>Works in a very similar way to getContentType, but returns Maybe of the string which is None if MIME type can not be identified.
getExtension: (path: string) => string | undefinedSupport function which helps to extract file extension from a path.
Contribution guidelines
The project is based on npm eco-system. Therefore, development process is organized via npm scripts.
For installation of dependencies run
npm installTo build application once
npm run buildTo build an application and watch for changes of files
npm run build:wTo run tslint one time for CI
npm run lintTo unit tests in a watching mode are performed by
npm run testTo execute a test suit single time
npm run test:onceTo execute a test suit single time with coverage report
npm run test:cTo execute a test suit single time with coverage report submitted to coveralls
npm run test:ciEverybody is welcome to contribute and submit pull requests. Please communicate your ideas and suggestions via issues.