4.1.0-beta.1 • Published 7 years ago

@doodad-js/mime v4.1.0-beta.1

Weekly downloads
1
License
Apache-2.0
Repository
github
Last release
7 years ago

"@doodad-js" Mime (beta).

NPM Version

<<<< PLEASE UPGRADE TO THE LATEST VERSION AS OFTEN AS POSSIBLE >>>>

Installation

$ npm install @doodad-js/mime

Features

  • Resolves file extensions to mime types.
  • Resolves mime types to file extensions.

NOTE: I'm waiting a database from IANA. Thanks to them for listening me.

Quick Start

    "use strict";

    const modules = {};
	require('@doodad-js/mime').add(modules);

    require('@doodad-js/core').createRoot(modules).then(root => {
			const mime = root.Doodad.Tools.Mime;
			console.log(mime.getTypes('index.html'));
			console.log(mime.getExtensions('text/plain'));
		}).catch(err => {
            console.error(err);
        });

Example

	"use strict";

	require('@doodad-js/core').createRoot()
		.then(root => {
			return root.Doodad.Modules.load([
				{
					module: '@doodad-js/mime'
				}
			]);
		})
		.then(root => {
			const mime = root.Doodad.Tools.Mime;
			return mime.getExtensions('text/plain');
		}).then(exts => {
			console.log(exts);
		}).catch(err => {
			console.error(err);
		});

Other available packages

  • @doodad-js/core: Object-oriented programming framework (release)
  • @doodad-js/cluster: Cluster manager (alpha)
  • @doodad-js/dates: Dates formatting (beta)
  • @doodad-js/http: Http server (alpha)
  • @doodad-js/http_jsonrpc: JSON-RPC over http server (alpha)
  • @doodad-js/io: I/O module (alpha)
  • @doodad-js/ipc: IPC/RPC server (alpha)
  • @doodad-js/json: JSON parser (alpha)
  • @doodad-js/loader: Scripts loader (beta)
  • @doodad-js/locale: Locales (beta)
  • @doodad-js/make: Make tools for doodad (alpha)
  • @doodad-js/mime: Mime types (beta)
  • @doodad-js/minifiers: Javascript minifier used by doodad (alpha)
  • @doodad-js/safeeval: SafeEval (beta)
  • @doodad-js/server: Servers base module (alpha)
  • @doodad-js/templates: HTML page templates (alpha)
  • @doodad-js/terminal: Terminal (alpha)
  • @doodad-js/test: Test application
  • @doodad-js/unicode: Unicode Tools (beta)
  • @doodad-js/widgets: Widgets base module (alpha)
  • @doodad-js/xml: XML Parser (beta)

License

Apache-2.0

This package also contains a modified database from "MimeTypeMap", licensed under MIT.