繁体   English   中英

从文本文件中读取URL,然后将该文件作为exe下载。 使用Javascript

[英]Read URL from text file and then download the file as an exe. Javascript

我想从txt文件中的URL下载文件。 我有一个文本文件

    https://server.com/file/downloadlink.txt 

并且该txt文件包含我当前的EXE下载URL。

txt文件包含的URL是

    https://server.com/file/downloadv1.exe

我还有一个php网页,它将从txt文件中获取URL并从指定的URL下载。

有任何想法吗?

只需使用Fetch API即可 像这样的东西:

fetch('https://example.com/file/downloadlink.txt').then((res) => {
  if (!res.ok) {
    throw new Error(res.statusText);
  }
  return res.text()
}).then((data) => {
  // Parse your text file here
});

不知道为什么你不会只是从那个URL重定向....

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM