企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
[TOC] > [github](https://github.com/rndme/download) ## 安装 ``` npm install downloadjs bower install downloadjs require("downloadjs")(data, strFileName, strMimeType); ``` ## 下载文件重命名 ``` $.ajax({ url:url, success: download.bind(true, "text/html", "demo.exe") }); ``` or ``` var x=new XMLHttpRequest(); x.open( "GET", "/diff6.png" , true); x.responseType="blob"; x.onload= function(e){download(e.target.response, "awesomesauce.png", "image/png");}; x.send(); ``` ## 填入内容,并下载文件 ``` download("hello world", "dlText.txt", "text/plain"); ``` ## 下载文件或二进制流 ``` download("/robots.txt"); download("/diff6.png"); ```