当前位置:网站首页>Save data in browser to local file
Save data in browser to local file
2022-07-01 06:02:00 【Chengfeng XS】
function localSave(data:any, filename: string){
if(!data) {
console.error('Console.save: No data')
return;
}
if(!filename) filename = 'console.json'
if(typeof data === "object"){
data = JSON.stringify(data, undefined, 4)
}
var blob = new Blob([data], {type: 'text/json'}),
e = document.createEvent('MouseEvents'),
a = document.createElement('a')
a.download = filename
a.href = window.URL.createObjectURL(blob)
a.dataset.downloadurl = ['text/json', a.download, a.href].join(':')
e.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null)
a.dispatchEvent(e)
}边栏推荐
- 我从技术到产品经理的几点体会
- Build 2022 上开发者最应关注的七大方向主要技术更新
- Through cooperation with the University of international trade, we can increase efficiency for college students
- Timer based on LabVIEW
- three.js小结
- MySQL怎么存储emoji?
- TiDB单机模拟部署生产环境集群(闭坑实践,亲测有效)
- Know the future of "edge computing" from the Nobel prize!
- Excel dynamic chart
- OpenGL es: (4) detailed explanation of EGL API (Continued)
猜你喜欢

无限水平大理石游戏

excel可视化

穿越派与贸大合作,为大学生增添效率

Multi label lsml for essay learning records

Crossing pie · pie pan + Mountain duck = local data management

OpenGL es: (5) basic concepts of OpenGL, the process of OpenGL es generating pictures on the screen, and OpenGL pipeline

相同区域 多源栅格数据 各个像元行列号一致,即行数列数相同,像元大小相同

el-table 动态表头渲染 固定第一列 高度问题

不是你脑子不好用,而是因为你没有找到对的工具

指数法和Random Forest实现山东省丰水期地表水体信息
随机推荐
LED lighting used in health lighting
srpingboot security demo
OpenGL es: (4) detailed explanation of EGL API (Continued)
MySQL里记录货币
3D打印机穿线:5种简单的解决方案
Advanced cross platform application development (II): uni app practice
Arcserver password reset (account cannot be reset)
68 Cesium代码datasource加载czml
El tooltip in the table realizes line breaking display
SOE spatial analysis server MySQL and PostGIS geospatial database of Postgres anti injection attack
Servlet
SystemVerilog学习-10-验证量化和覆盖率
2022 the 8th China International "Internet +" college student innovation and entrepreneurship competition industry proposition track is open for registration!
OpenGL ES: (5) OpenGL的基本概念、OpenGL ES 在屏幕产生图片的过程、OpenGL管线(pipeline)
How to add a gourd pie plate
Crossing sect · paipan + Siyuan notes = private notebook
Continue to learn MySQL
Looking for high school student developers with similar interests
Huluer app help
Leetcode Max rectangle, Max square series 84 85. 221. 1277. 1725. (monotonic stack, dynamic programming)