java如何使用angularJS将共享文件夹文件复制到本地计算机
我在swing(JAVA)中创建了一个工具,通过该工具,我将文件从共享位置复制到本地系统中。我不想在AngularJS中做同样的事情。有没有任何方法可以将文件从一个位置复制到另一个位置。共享文件夹位置和本地计算机位置由用户提供。我只需要从textfield中获取位置并执行复制粘贴操作
编写我在swing中编写的代码: `
void copyPaste(String l,String m )
{
File srcDir = new File(l);
File destDir = new File(m);
try {
FileUtils.copyDirectory(srcDir, destDir);
} catch (IOException e) {
JOptionPane.showMessageDialog(null, e);
System.exit(1);
}
}`
我如何在AngularJS中实现同样的功能
# 1 楼答案
出于安全原因,Javascript不支持客户端文件操作
File and Directory Entries API是非标准的,允许您操作sandoboxed文件系统(不能将文件写入任意文件夹)
如果你想坚持使用javascript,你可以在服务器端用NodeJS(例如this模块)复制代码