• 保存json文件
const obj = { hello: 'world' };
const blob = new Blob([ JSON.stringify(obj) ], {type : 'application/json'});
  • 保存htm文件,并生成地址
const htmlFragment = ['<a id="a"><b id="b">hey!</b></a>'];
const myBlob = new Blob(htmlFragment, {type : 'text/html'});
const url = URL.createObjectURL(myBlob);