简体   繁体   English

如何使用电子将文件传输到USB底座

[英]How to transfer files to a usb mount with electron

In an electron app I'm trying to transfer some files in an attached usb device. 在电子应用程序中,我试图在附加的USB设备中传输一些文件。

I used usb-detection module to detect a new usb but it doesn't give any details about the mount path so how can I transfer files? 我使用usb检测模块来检测新的usb,但它没有提供有关挂载路径的任何细节,那么我如何传输文件?

(Preferably cross platform solution) (最好是跨平台解决方案)

First you can use os.platform() to define the OS with file system. 首先,您可以使用os.platform()来定义具有文件系统的OS。 Then nodejs exec to spawn a process to be able to execute bash code to actually get the list of drives. 然后nodejs exec生成一个进程,以便能够执行bash代码来实际获取驱动器列表。 Then simply return those values and use in the code with fs . 然后只需返回这些值并在代码中使用fs Checkout in the example here . 这里的示例中结帐。

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

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