I'm creating an Electron application.
I have a file menu item "Open File" which I want to connect to an HTML Input[type="file"] Element by calling click() on the element. The element is already visible and works if it's actually clicked.
I'm aware of Electron's Dialog API and Node's FileSystem, but the problem is that I can't retrieve the same data from using those as I do with the HTML element. For example, in Node's FileSystem I can receive utf-8 encoded file data or buffer data if I don't encode, but I need to access the selected file as a File object, with properties such as name, file and type, as I would from the HTML Element, as logged in this image:
I've already implemented drag-and-drop functionality that uses the File object and I already actually have an Input[type="file"] element in my application that works if I physically click on it and appropriately handles the selected file, so I don't want to have to write new edgecase code to handle a selected files chosen from the application menu with Electron Dialog and Node FS.
Is there anyway around this?
via TheDarkIn1978

No comments:
Post a Comment