Skip to content

Convert a String to a Blob object in JavaScript

To convert a string to a blob in JavaScript we are going to pass the string to a Blob constructor and return the string.

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


//Blob {size: 8, type: ""}
//size: 8
//type: ""
//__proto__: Blob
See also  How to hide turtle in Python?

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.