package
A centralized parsing module that can be extended to handle any mime type
npm install parse-mimeGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 9 packages.
637.0 kB
Includes dependencies.
A centralized parsing module that can be extended to handle any mime type
With packin: packin add jkroso/parse-mime
then in your app:
var parse = require('parse-mime')parse(mime, data)Takes a mimetype string and some data and returns the parsed value. If it doesn't know how to parse the given mimetype it will just return the data unchanged
parse('application/json', '[1,2,3]') // => [1,2,3]parse.define(mime, fn)Define a parser for a new mimetype
parse.define('application/edn', JSON.parse)
parse('application/edn', '[1,2,3]') // => [1,2,3]If the mimetype has already been defined then it will throw an error