npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

quoted-printable-lite

v0.2.0

Published

Lightweight, zero-dependency Quoted-Printable transfer encoding as defined by RFC 2045

Downloads

7

Readme

quoted-printable-lite

  • Ever needed to send utf-8 data through communication standards established in the 90s and earlier?
  • Want a simple, zero-dependency library you can shove a buffer containing utf8 text into and get 7-bit safe data in return?
  • Are you that afraid of using base64 to bloat the size of your auto-generated e-mails?
  • Are you parsing .eml files for some strange-ass reason?

Well, then quoted-printable-lite is the package for you

This package implements the Quoted-Printable content transfer encoding as defined by RFC 2045

What is a "Quoted-Printable"?

It's a binary-to-text encoding scheme that only uses 7-bit ascii. Think URI-Encoding except with "=" instead of "%" with a 76 character wide limit (I know right)

Where can I use it?

Browser and node. This thing will use/return Buffers if it finds a global Buffer object. Otherwise, it'll use Uint8Arrays

How do I use it?

const {encode, decode} = require("quoted-printable-lite");
const textToEncode = "Hello, world!😄\nHow are you? This is a real nice day today, isn't it? Do you think I hit 76 characers yet for this demonstration? Probably";


const encodedBuffer = encode(
    Buffer.from(textToEncode), // You can use TextEncoder.prototype.encode on the browser for this
    true, // crlf = true, makes line breaks "\r\n". Otherwise, "\n"
    false, // binary = false, if true, it'll escape "\r" and "\n" characters as-is. Otherwise, line-breaks are converted to whatever's above
    76 // maxLineLength = 76, lines will not exceed this length
);

const encodedString = buffer.toString(); // You can use String.fromCharCode(...buffer) on the browser for this
/*
Will output:
    "Hello, world!=F0=9F=98=84\r\n" +
    "How are you? This is a real nice day today, isn't it? Do you think I hit 76=\r\n" +
    " characers yet for this demonstration? Probably"
*/
console.log(encodedString);

const decodedBuffer = decode(
    encodedBuffer,
    true, // crlf = true, makes line breaks "\r\n". Otherwise, "\n" (escaped "\r" and "\n" characters are unaffected)
    false // inPlace = false, if true, the given buffer will be edited and a subarray will be returned
);

/*
Will output:
"Hello, world!😄\r\nHow are you? This is a real nice day today, isn't it? Do you think I hit 76 characers yet for this demonstration? Probably"
*/
console.log(decodedBuffer.toString());