Open this example in the interactive library
Source code
const blob = new Blob(["header:message"]);
const range = blob.slice(7, 14, "text/plain");
console.log(range.type, await range.text());
Sample output
text/plain message

Open this example in the interactive library
const blob = new Blob(["header:message"]);
const range = blob.slice(7, 14, "text/plain");
console.log(range.type, await range.text());
text/plain message