through consulting materials, it is found that there are two main ways to download JS files on the Internet:
1. Using the downLoad attribute of the a tag, through URL.createObjectURL ()
2. Use the file system FileSystem, to download the files to sandboxie in the browser.
(for example:
window.webkitRequestFileSystem(Window.TEMPORARY,1024*1024,function(fs) {
var fileEntry = fs.root.getFile("Test.txt",{create: true});
var fileWriter = fileEntry.createWriter();
fileWriter.seek(10);
var blob = new Blob(["hello,the world"]);
fileWriter.write(blob);
console.log("Successfuly")
},(err) => {
console.log(err);
});
}
would like to ask all code friends how to achieve JS download files to the specified local file directory?