How can I decode quoted-printable content to normal strings in node.js?

For example, I have a string "this=20is=20a=20string" that I want to convert to "this is a string".

Is there a library function or a npm module that does it or should I make my own function to do it?

Use mimelib:

var mimelib = require("mimelib");
mimelib.decodeQuotedPrintable("this=20is=20a=20string") === "this is a string"
mimelib.decodeMimeWord("=?iso-8859-1?Q?=27text=27?=") === "'text'"

s = "this=20is=20a=20string"
s.replace(/=20/g, ' '); // => "this is a string"

Although if =20 is meant to be a hex character number (delimited by "=" instead of "%"?) then this would be more general:

"foo=21".replace(/=([A-Fa-f0-9]{2})/g, function(m, g1) {
  return String.fromCharCode(parseInt(g1, 16));
}); // => "foo!"