{"name":"libqp","version":"3.0.0","keywords":["quoted-printable","mime"],"author":{"name":"Andris Reinman"},"license":"MIT","_id":"libqp@3.0.0","maintainers":[{"name":"andris","email":"andris@kreata.ee"}],"homepage":"https://github.com/nodemailer/libqp","bugs":{"url":"https://github.com/nodemailer/libqp/issues"},"dist":{"shasum":"ab1ea895f51f1b5d095066bced1458509ffdc2ec","tarball":"http://registry-npm.ywwl.com/libqp/download/libqp-3.0.0.tgz","fileCount":13,"integrity":"sha512-A4gnoiM9eKQ1fzFl1cUaHrghN/yw4leSQAQwPLXeJo36iVP+pjraAq9/fVylyow8UHL/N8jIx4O0Q1zKkI02tg==","signatures":[{"sig":"MEQCIHHnvpSJP4+LFGmivOe0SZCgOww2oqTgUUIYjeOo3eryAiAT5fLazobbedWMdOK2/gXbHh11L4TqsjRuOHkWgG6xdA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQDhj7fWj8doksVXbXXIyjMRmUtylOyQCKg6hMCiI+j2bwIgZj9jbBn7eHZIvayhDLZUXFSqMz9JRCuvsLL23OcxASc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/libqp@3.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":53185,"size":12362,"noattachment":false,"key":"/libqp/-/libqp-3.0.0.tgz"},"main":"./dist/cjs/libqp.js","type":"module","types":"./dist/cjs/libqp.d.ts","engines":{"node":">=20.0.0"},"exports":{".":{"import":"./dist/esm/libqp.js","require":"./dist/cjs/libqp.js"},"./lib/libqp":{"import":"./dist/esm/libqp.js","require":"./dist/cjs/libqp.js"},"./lib/libqp.js":{"import":"./dist/esm/libqp.js","require":"./dist/cjs/libqp.js"},"./package.json":"./package.json"},"gitHead":"a24d1c8f7dcf3a4909388d3d698fa1997ae44bf5","scripts":{"lint":"npm run typecheck && eslint .","test":"node --import tsx --test $(find test -name '*-test.ts')","build":"node scripts/build.js","format":"prettier --write \"**/*.{js,cjs,ts,json,md,yml,yaml}\"","update":"rm -rf node_modules package-lock.json && ncu -u && npm install","prepare":"npm run build","pretest":"npm run build","lint:fix":"eslint . --fix","test:bun":"bun test --timeout 60000 $(find ./test -name '*-test.ts')","test:fuzz":"FUZZ_ITERATIONS=${FUZZ_ITERATIONS:-20000} FUZZ_SEED=${FUZZ_SEED:-random} node --import tsx --test test/property-test.ts test/legacy-test.ts","typecheck":"tsc -p tsconfig.json","pretest:bun":"npm run build","format:check":"prettier --check \"**/*.{js,cjs,ts,json,md,yml,yaml}\"","test:coverage":"c8 node --import tsx --test $(find test -name '*-test.ts')","test:mutation":"node scripts/mutation-test.js","pretest:coverage":"npm run build"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"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","typesVersions":{"*":{"lib/*":["dist/cjs/*.d.ts"]}},"_hasShrinkwrap":false,"devDependencies":{"c8":"12.0.0","tsx":"4.23.15","eslint":"10.13.0","globals":"17.13.0","prettier":"3.9.10","fast-check":"4.10.2","typescript":"6.0.3","@types/node":"20.19.43","libqp-legacy":"npm:libqp@2.1.3","typescript-eslint":"8.71.2","eslint-config-prettier":"10.1.8"},"_npmOperationalInternal":{"tmp":"tmp/libqp_3.0.0_1792345854018_0.7906568222901635","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":1792345854122,"_cnpm_publish_time":1792345854122,"dist-tags":{"latest":"3.0.2"}}