zoukankan      html  css  js  c++  java
  • javascript输出数据到文件

    function export(name, data) {
      var urlObject = window.URL || window.webkitURL || window
      var export_blob = new Blob([data])
      var save_link = document.createElementNS('http://www.w3.org/1999/xhtml', 'a')
      save_link.href = urlObject.createObjectURL(export_blob)
      save_link.download = name
      fakeClick(save_link)
    },
    function fakeClick(obj) {
      var ev = document.createEvent('MouseEvents')
      ev.initMouseEvent('click', true, false, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null)
      obj.dispatchEvent(ev)
    }
    
    export("test.txt", "hello world");
    
    
  • 相关阅读:
    pytorch基础(4)-----搭建模型网络的两种方法
    Java
    Tools
    Maven
    Java
    DevOps
    Linux
    Java
    Java
    Nutch 使用总结
  • 原文地址:https://www.cnblogs.com/bunuo/p/13846147.html
Copyright © 2011-2022 走看看