I have been playing around with the file system drag and drop functionality of Electron apps and haven't had any issues getting everything to work with local files. I have not come across anything in the documentation, so I'd like to see if anyone knows if this is possible. I'd like to use the drag-out feature in Electron to drag a remote file outside of the app and onto the file system.
Specific example: The program I am working on is a remote file management tool - similar to dropbox. I'd like to drag the dom element representing the remote file to a Finder (or Windows Explorer) window and have Electron download the file to that location.
I am able to get this to work as long as the file is stored locally following the Electron documentation. http://electron.atom.io/docs/all/#dragging-files-out-of-the-window
I can envision two possible solutions:
- Does electron have the ability to pass a DownloadItem or a URL to the 'startDrag' event (as referenced in the link above)?
- Is it possible to listen for a 'dropped' even of some kind and get the local file system path of where my dom element was dropped? For example, /Users/{proile}/Desktop? I could use my existing download methods to download the file to that specific path.
Any thoughts on how I can accomplish my goal? Thanks so much for your time.
I haven't seen any examples of this sort of functionality – but it doesn't seem like it would be hard to cobble it together (famous last words...)
At least that is how I would start to approach it. There are various electron related libs dealing with downloads (e.g. electron-dl). If you get this working, report back and share the details.