{"name":"libqp","version":"2.1.2","keywords":["quoted-printable","mime"],"author":{"name":"Andris Reinman"},"license":"MIT","_id":"libqp@2.1.2","maintainers":[{"name":"andris","email":"andris@kreata.ee"}],"homepage":"https://github.com/nodemailer/libqp","bugs":{"url":"https://github.com/nodemailer/libqp/issues"},"dist":{"shasum":"d8d94ee8ed182c603d4aead9c7a8e5f72cb820ca","tarball":"http://registry-npm.ywwl.com/libqp/download/libqp-2.1.2.tgz","fileCount":11,"integrity":"sha512-rp+U80tl9Os4K7GnVbPzPRmghPu6eqB8rcF+ontvNAnoga0JhMFG/bkTD/reC8yoznKMgOc5/ttZHJasiWeFPw==","signatures":[{"sig":"MEUCIQDRODJKfPtger73+DP5IXMGMiv6NeUDUQyZIZFhvUxA0gIgQI6TSgpk1Ht83gMaA+GSXSDjc3X9g43bbvqYHv98oJY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEYCIQDbdeI5AoTKHt1ADnM6j55KKEvnG0GrHE68V+G+2j6wMgIhALfOlYVrkc6ZvFS8QRo9GPlfZoFflC75tUKrraiDnKst","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/libqp@2.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":26021,"size":7320,"noattachment":false,"key":"/libqp/-/libqp-2.1.2.tgz"},"main":"lib/libqp.js","gitHead":"69243712e4684e217c7ce136ac3c923673d95d64","scripts":{"test":"node --test","update":"rm -rf node_modules package-lock.json && ncu -u && npm install"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:fa4ececa-4c8d-401e-ab09-81b57f702a99"}},"repository":{"url":"git://github.com/nodemailer/libqp.git","type":"git"},"_npmVersion":"11.19.0","description":"Encode and decode quoted-printable strings according to rfc2045","directories":{},"_nodeVersion":"24.21.0","_hasShrinkwrap":false,"devDependencies":{"eslint-config-prettier":"10.1.8","eslint-config-nodemailer":"1.2.0"},"_npmOperationalInternal":{"tmp":"tmp/libqp_2.1.2_1790603699503_0.8197539172690911","host":"s3://npm-registry-packages-npm-production"},"readme":"# libqp\n\nEncode and decode quoted-printable strings according to [RFC2045](https://tools.ietf.org/html/rfc2045#section-6.7).\n\n## Usage\n\nInstall with npm\n\n```\nnpm install libqp\n```\n\nlibqp requires Node.js 20 or newer. It is written in TypeScript and ships both an ES module and a CommonJS build, each with type declarations.\n\n```javascript\n// ES modules\nimport libqp from 'libqp';\n// or\nimport { encode, decode, wrap, Encoder, Decoder } from 'libqp';\n\n// CommonJS\nconst libqp = require('libqp');\n```\n\n### Encode values\n\nEncode Buffer objects or unicode strings with\n\n```\nlibqp.encode(val) → String\n```\n\nWhere\n\n- **val** is a Buffer, an Uint8Array or an unicode string (encoded as UTF-8)\n\n`encode` escapes whitespace at the end of a line and a hyphen at the start of a line, so the output never contains a line that could be read as a MIME boundary.\n\n**Example**\n\n```javascript\nlibqp.encode('jõgeva');\n// j=C3=B5geva\n```\n\n### Decode values\n\nDecode Quoted-Printable encoded strings with\n\n```\nlibqp.decode(str) → Buffer\n```\n\nWhere\n\n- **str** is a Quoted-Printable encoded string, Buffer or Uint8Array. A Buffer is read byte for byte, so raw 8-bit bytes in the input are kept as they are. A char of a string is read as the low byte of its char code, so pass a binary string (`buf.toString('binary')`) rather than a unicode one\n\n**Example**\n\n```javascript\nlibqp.decode('j=C3=B5geva').toString();\n// jõgeva\n```\n\n### Wrap encoded values\n\nQuoted-Printable encoded lines are limited to 76 characters but `encode` method might return lines longer than the limit.\n\nTo enforce soft line breaks on lines longer than 76 (or any other length) characters, use `wrap`\n\n```\nlibqp.wrap(str[, lineLength]) → String\n```\n\nWhere\n\n- **str** is a Quoted-Printable encoded string\n- **lineLength** (defaults to 76) is the maximum allowed line length. Any longer line will be soft wrapped. Values below 4 are raised to 4, the shortest line that fits an escape sequence and a soft line break. Every line is wrapped on its own and a line break does not count towards the line length\n\n**Example**\n\n```javascript\nlibqp.wrap('abc j=C3=B5geva', 10);\n// abc j=\\r\\n\n// =C3=B5geva\n```\n\n### Transform Streams\n\n`libqp` makes it possible to encode and decode streams with `libqp.Encoder` and `libqp.Decoder` constructors.\n\n### Encoder Stream\n\nCreate new Encoder Stream with\n\n```\nconst encoder = new libqp.Encoder([options])\n```\n\nWhere\n\n- **options** is the optional stream options object with additional options:\n    - **lineLength** if you want to use any other line length than the default 76 characters (or set to `false` to turn the soft wrapping off completely)\n    - **binary** set to `true` if the input is binary data. A CR or LF that is not part of a CRLF pair is then encoded, so that line ending conversions on the way can not change the data\n\n**Example**\n\nThe following example script reads in a file, encodes it to Quoted-Printable and saves the output to a file.\n\n```javascript\nimport fs from 'node:fs';\nimport { Encoder } from 'libqp';\n\nconst source = fs.createReadStream('source.txt');\nconst encoded = fs.createWriteStream('encoded.txt');\n\nsource.pipe(new Encoder()).pipe(encoded);\n```\n\n### Decoder Stream\n\nCreate new Decoder Stream with\n\n```\nconst decoder = new libqp.Decoder([options])\n```\n\nWhere\n\n- **options** is the optional stream options object\n\nThe Decoder collects its input and decodes it once the input ends, so escape sequences and soft line breaks split between chunks are decoded correctly.\n\n**Example**\n\nThe following example script reads in a file in Quoted-Printable encoding, decodes it and saves the output to a file.\n\n```javascript\nimport fs from 'node:fs';\nimport { Decoder } from 'libqp';\n\nconst encoded = fs.createReadStream('encoded.txt');\nconst dest = fs.createWriteStream('dest.txt');\n\nencoded.pipe(new Decoder()).pipe(dest);\n```\n\n## License\n\n**MIT**\n","publish_time":1790603699608,"_cnpm_publish_time":1790603699608,"dist-tags":{"latest":"3.0.2"}}