mime-info-stream-parser
Convert freedesktop mime info XML to a simple JSON dictionary.
The freedesktop project provides an XML spec and 700+ mime type descriptions.
The parser implements a transform stream using sax js internally, converting freedesktop mime info XML to a JSON stream. Written to file, the output can be used:
// tsconfig.json compilerOptions.resolveJsonModule = true; console.logdb;/*{ comment: 'plain text document',}*/console.logdb;/*{ comment: 'PDF document', acronym: 'PDF', acronymExpanded: 'Portable Document Format'}*/// PDF aliasconsole.logdb;/*{ comment: 'PDF document', acronym: 'PDF', acronymExpanded: 'Portable Document Format'}*/
Mime type aliases are expanded to full entries. Each entry value is of type:
;
Usage
yarn add mime-info-stream-parser
Typescript
;;; ;; ; pipelineread, mimeInfo, write,;
Node.js
const MimeInfoStreamParser = ;// ...
Development
$ yarn && yarn test
$ yarn describe
info:
Display information about the package scripts
build:
Clean and rebuild the project
fix:
Try to automatically fix any linting problems
test:
Lint and unit test the project
watch:
Watch and rebuild the project on save, then rerun relevant tests
cov:
Rebuild, run tests, then create and open the coverage report
reset:
Delete all untracked files and reset the repo to the last commit
License
MIT