{ "name": "mimelib", "description": "MIME functions to encode/decode e-mails etc.", "version": "0.2.14", "author": { "name": "Andris Reinman" }, "homepage": "http://github.com/andris9/mimelib", "maintainers": [ { "name": "andris", "email": "andris@node.ee" } ], "contributors": [ { "name": "Swift", "email": "theycallmeswift@gmail.com" } ], "repository": { "type": "git", "url": "http://github.com/andris9/mimelib.git" }, "scripts": { "test": "nodeunit test/" }, "main": "index.js", "licenses": [ { "type": "MIT", "url": "http://github.com/andris9/mimelib/blob/master/LICENSE" } ], "dependencies": { "encoding": "~0.1", "addressparser": "~0.2.0" }, "devDependencies": { "nodeunit": "*" }, "keywords": [ "e-mail", "mime", "email" ], "readme": "# mimelib\n\n*mimelib* is a collection of useful functions to deal with mime-encoded data.\n\n## Installation\n\nInstall with *npm*\n\n npm install mimelib\n \n## Usage\n\n var mimelib = require(\"mimelib\");\n\n## Reference\n\n### foldLine\n\nFolds a long line according to the RFC 5322 \n\n mimelib.foldLine(str [, maxLength][, foldAnywhere][, afterSpace]) -> String\n \n - `str` (String): mime string that might need folding\n - `maxLength` (Number): max length for a line, defaults to 78\n - `foldAnywhere` (Boolean): can fold at any location (ie. in base64)\n - `afterSpace` (Boolean): If `true` fold after the space\n \n\nFor example:\n\n Content-Type: multipart/alternative; boundary=\"----zzzz----\"\n\nwill become\n\n Content-Type: multipart/alternative;\n boundary=\"----zzzz----\"\n\n### encodeMimeWord\n\nEncodes a string into mime encoded word format (see also `decodeMimeWord`)\n\n mimelib.encodeMimeWord = function(str [, encoding][, charset])\n\n - `str` (String): String to be encoded\n - `encoding` (String): Encoding Q for quoted printable or B (def.) for base64\n - `charset` (String): Charset to be used\n \nFor example:\n\n See on õhin test\n\nBecomes with UTF-8 and Quoted-printable encoding\n\n =?UTF-8?Q?See_on_=C3=B5hin_test?=\n \n### decodeMimeWord\n\nDecodes a string from mime encoded word format (see also `encodeMimeWord`)\n\n mimelib.decodeMimeWord(str) -> String\n \n - `str` (String): String to be decoded\n\nFor example\n\n mimelib.decodeMimeWord(\"=?UTF-8?Q?See_on_=C3=B5hin_test?=\");\n\nwill become\n\n See on õhin test\n\n### encodeQuotedPrintable\n\nEncodes a string into Quoted-printable format (see also `decodeQuotedPrintable`)\n\n mimelib.encodeQuotedPrintable(str [, mimeWord][, charset]) -> String\n \n - `str` (String): String to be encoded into Quoted-printable\n - `mimeWord` (Boolean): Deprecated, has no effect, ignore it\n - `charset` (String): Destination charset, defaults to UTF-8\n\n### decodeQuotedPrintable\n\nDecodes a string from Quoted-printable format (see also `encodeQuotedPrintable`)\n\n mimelib.decodeQuotedPrintable(str [, mimeWord][, charset]) -> String\n \n - `str` (String): String to be decoded\n - `mimeWord` (Boolean): Deprecated, has no effect, ignore it\n - `charset` (String): Charset to be used, defaults to UTF-8\n \n### encodeBase64\n\nEncodes a string into Base64 format. Base64 is mime-word safe (see also `decodeBase64`)\n\n mimelib.encodeBase64(str [, charset]) -> String\n \n - `str` (String): String to be encoded into Base64\n - `charset` (String): Destination charset, defaults to UTF-8\n\n### decodeBase64\n\nDecodes a string from Base64 format. Base64 is mime-word safe (see also `encodeBase64`)\n\nNB! Always returns UTF-8\n\n mimelib.decodeBase64(str) -> String\n\n - `str` (String): String to be decoded from Base64\n - `charset` (String): Source charset, defaults to UTF-8\n \n### parseHeaders\n\nParses header lines into an array of objects (see `parseHeaderLine`)\n\n mimelib.parseHeaders(headers) -> Array\n \n - `headers` (String): header section of the e-mail\n\nExample:\n\n var headers = [\n \"From: andris@node.ee\",\n \"To: juulius@node.ee\",\n \"To: juulius2@node.ee\",\n \"Content-type: text/html;\",\n \" charset=utf-8\"\n ].join(\"\\r\\n\");\n mimelib.parseHeaders(headers);\n\nResults in \n\n {\"from\": [ 'andris@node.ee' ],\n \"to\": [ 'juulius@node.ee', 'juulius2@node.ee' ],\n \"content-type\": [ 'text/html; charset=utf-8' ] }\n\n### parseAddresses\n\nParses names and addresses from a from, to, cc or bcc line\n\n mimelib.parseAddresses(addresses) -> Array\n \n - `addresses` (String): string with comma separated e-mail addresses \n \nExample:\n\n var to = '\"Andris Reinman\" , juulius@node.ee'\n mimelib.parseAddresses(to);\n \nResults in\n\n [{ address: 'andris@node.ee', name: 'Andris Reinman' },\n { address: 'juulius@node.ee', name: false }]\n\n### parseMimeWords\n\nParses mime-words into UTF-8 strings\n\n mimelib.parseMimeWords(str) -> String\n\n - `str` (String): string to be parsed, if includes any mime words, then these are converted to UTF-8 strings\n \n \nFor example:\n\n mimelib.parseMimeWords(\"Hello: =?UTF-8?Q?See_on_=C3=B5hin_test?=\");\n\nResults in\n\n \"Hello: See on õhin test\"\n \n### parseHeaderLine\n\nParses a header line to search for additional parameters.\n\n mimelib.parseHeaderLine(line) -> Object\n \n - `line` (String): a line from a message headers\n \nFor example:\n\n mimelib.parseHeaderLine(\"text/plain; charset=utf-8\")imelib\n\nResults in\n\n {\"defaultValue\": 'text/plain',\n \"charset\": 'utf-8' }\n\n### contentTypes\n\n**NB! this feature is deprecated**, use [mime](https://github.com/broofa/node-mime) module instead to detect content types and extensions\n\n`mimelib.contentTypes` is an object to provide content type strings for common\nfile extensions\n\n mimelib.contentTypes[\"xls\"]; // \"application/vnd.ms-excel\"\n\n## iconv support\n\nBy default only iconv-lite support is bundled. If you need node-iconv support, you need to add it\nas an additional dependency for your project:\n\n ...,\n \"dependencies\":{\n \"mimelib\": \"*\",\n \"iconv\": \"*\"\n },\n ...\n\n## License\n\nmimelib license is", "readmeFilename": "README.md", "_id": "mimelib@0.2.14", "dist": { "shasum": "8462ec56b40fa88f639e615030d1a411db2d2e41" }, "_from": "mimelib@0.2.14", "_resolved": "https://registry.npmjs.org/mimelib/-/mimelib-0.2.14.tgz" }