Log in New API Help About

Using the dpaste.com API with Javascript

360 bytes of JavaScript
Created 1 month ago by dpaste.com
https://dpaste.com/898G5RRP7
SOFT WRAP RAW TEXT DUPLICATE DIFF
async function dpaste(content) {
  var response = await fetch("https://dpaste.com/api/", {
    method: "POST",
    headers: { "Content-Type": "application/x-www-form-urlencoded" },
    body: "content=" + encodeURIComponent(content),
  });
  return response.text();
}

// Usage:
dpaste("Example content").then(paste_url => { console.log(paste_url) });