Skip to content

Convert a string to a Blob object in JavaScript

const str2blob = txt => new Blob([txt]);

console.log(str2blob("Poopcode"))

//Blob {size: 8, type: ""}
//size: 8
//type: ""
//__proto__: Blob

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.