简体   繁体   English

如何确定saveAs()Function javascript或打字稿的路径?

[英]How can determine path for saveAs()Function javascript or typescript?

Q1: How can determine path for saveAs()Function javascript ? 问题1:如何确定saveAs()Function javascript的路径?

I wanna after downloaded file I wanna select path such as 我想下载文件后想要选择路径,例如

C:\\Users\\file-\\projectName\\src\\assets\\i18n\\en.json C:\\ Users \\用户文件 - \\ PROJECTNAME的\\ src \\资产\\国际化\\ en.json

const blob = new Blob([data], {type : 'application/json'});
saveAs( blob , 'en.json');

Q2: How can I save data in same file after download ? 问题2:下载后如何将数据保存在同一文件中? such as

saveAs( blob , 'en.json');// new file
save( blob , 'en.json'); // same file
  1. You can't. 你不能 The file path will always be set to the assigned downloads folder in your browser settings. 文件路径将始终设置为浏览器设置中分配的下载文件夹。
  2. Also not possible, if you try to overwrite a file it will automatically rename the new one to avoid overwriting. 同样,如果尝试覆盖文件,它将自动重命名新文件以避免覆盖。

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

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