Les blobs servent à travailler sur des données binaires (gros fichiers images, vidéos),
ou créer une nouvelle fenêtre avec des données temporaires,,
ou télécharger un fichier.,

Crée un blob depuis un string:
// Le 1er argument doit être un tableau
let blob = new Blob(["<html>…</html>"], {type: 'text/html'});
Ajoute un sélecteur CSS à la page: met le fond en jaune
window.URL = window.URL || window.webkitURL;
var blob = new Blob(['body { background-color: yellow; }'], {type: 'text/css'});
var link = document.createElement('link');
link.rel = 'stylesheet';
//createObjectURL returns a blob URL as a string.
link.href = window.URL.createObjectURL(blob);
document.body.appendChild(link);
Change le contenu du body
var blob = new Blob('[<h1>my html blob</h1>'], {type: 'text/html'});
document.getElementsByTagName("body")[0].innerHTML = blob;
Télécharge automatiquement un fichier hello.txt qui contient hello world
let link = document.createElement('a');
link.download = 'hello.txt';
let blob = new Blob('[Hello, world!'], {type: 'text/plain'});
link.href = URL.createObjectURL(blob);
link.click();
document.write('link.href='+link.href);
URL.revokeObjectURL(link.href);
Autre syntaxe
function download(text, filename){
  var blob = new Blob([text], {type: "text/plain"});
  var url = window.URL.createObjectURL(blob);
  var a = document.createElement("a");
  a.href = url;
  a.download = filename;
  a.click();
}

download("this is the file", "text.txt");
Le navigateur n'a pas le droit d'écrire des fichiers localement. Donc pour débugger une appli et présenter la valeur des variables dans un onglet qui peut être fermé sans crainte, crée une nouvelle fenêtre avec des données temporaires
var text = 'hello blob';
var blob = new Blob([text], { type: 'text/plain' });
let textFile = window.URL.createObjectURL(blob);
let window2 = window.open(textFile, 'log.' + new Date() + '.txt');
window2.onload = e => window.URL.revokeObjectURL(textFile);