久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何處理電子中的本地文件上傳?

How do I handle local file uploads in electron?(如何處理電子中的本地文件上傳?)
本文介紹了如何處理電子中的本地文件上傳?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我很難弄清楚如何在原子電子中處理文件上傳.我會發布代碼,但我什至不知道從哪里開始.

I'm having a hard time figuring out how to approach file uploads in atom electron. I would post code but I don't even know where to begin with this one.

在標準 Web 應用程序中,我會通過標準回發或使用 ajax 請求從客戶端發布到服務器.我有一些非常酷的解決方案.但是在電子的情況下,我不確定在哪里或如何發布"電子.文件回來.我想我只想從 node.js 訪問我的 <input type='file'/> 的內容.我該怎么做?

In a standard web app I would post from the client to the server, either via a standard postback or using an ajax request. I have some pretty cool solutions for that. But in the case of electron, I'm not sure where or how to "post" the file back. I guess I just want to access the contents of my <input type='file' /> from node.js. How do I do this?

我可以發布到瀏覽器進程,但我不知道地址"是什么.將是.或者我需要創建一個單獨的頁面"嗎?在我的應用程序中只是為了接受表單帖子?我在網絡開發方面的背景可能讓我看不到一些明顯的答案,有人可以幫忙嗎?

I could post to the browser process, but I don't know what the "address" would be. Or do I need to create a separate "page" in my app just to accept form posts? My background in web-dev is probably blinding me to some obvious answer, can someone help?

只是為了添加更多上下文,我有一個 .csv 文件,我想允許用戶上傳該文件.然后我將使用 node-csv 處理這個并將每個返回的行插入到應用程序的 nedb 數據存儲中.

Just to add a little more context, I have a .csv file which I'd like to allow the user to upload. I will then process this using node-csv and insert each returned row into the app's nedb datastore.

推薦答案

如果您要在用戶的機器上處理文件,則無需將文件上傳到任何地方,它已經在您需要的地方.您需要做的就是彈出一個對話框,允許用戶瀏覽他們的文件系統并選擇他們希望您的應用程序處理的文件.您可以創建一個按鈕并調用 dialog.showOpenDialog 當用戶按下它時,它會給你一個文件名,然后你可以使用 Node 的 fs.readFile 從磁盤讀取它,然后您可以繼續以任何您想要的方式處理內容.

If you're going to process the file on the user's machine then there is no need to upload the file anywhere, it's already exactly where you need it. All you need to do is popup a dialog to allow the user to browse their file system and select the file they want your app to process. You can create a button and call dialog.showOpenDialog when the user presses it, that will get you a filename and you can then use Node's fs.readFile to read it from disk, then you can go ahead and process the contents in whichever way you want.

這篇關于如何處理電子中的本地文件上傳?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

discord.js v12: How do I await for messages in a DM channel?(discord.js v12:我如何等待 DM 頻道中的消息?)
how to make my bot mention the person who gave that bot command(如何讓我的機器人提及發出該機器人命令的人)
How to fix Must use import to load ES Module discord.js(如何修復必須使用導入來加載 ES 模塊 discord.js)
How to list all members from a specific server?(如何列出來自特定服務器的所有成員?)
Discord bot: Fix ‘FFMPEG not found’(Discord bot:修復“找不到 FFMPEG)
Welcome message when joining discord Server using discord.js(使用 discord.js 加入 discord 服務器時的歡迎消息)
主站蜘蛛池模板: 久久国产精品偷 | 精品国产一区二区三区久久久久久 | 欧美色综合天天久久综合精品 | 欧美在线一区二区三区 | 亚洲日本欧美日韩高观看 | 欧美1区 | 免费一二区 | 亚洲一区二区高清 | 亚洲精品丝袜日韩 | 爱高潮www亚洲精品 中文字幕免费视频 | 欧美日韩精品中文字幕 | 国产一区二区三区在线 | 天天操天天拍 | 成人福利在线 | 久久国产精品一区二区三区 | 风间由美一区二区三区在线观看 | 久久精品国产99国产精品 | 亚洲一区在线播放 | 久草资源在线视频 | 欧美一二三四成人免费视频 | 欧美综合一区 | 免费三级av | 99综合| 偷拍亚洲色图 | 日韩高清一区 | 91热爆在线观看 | 黄色毛片一级 | 91在线视频播放 | 精品欧美一区二区三区 | 日韩在线视频观看 | 羞羞视频在线观免费观看 | 香蕉视频黄色 | 欧美精品一区免费 | 中文字幕人成乱码在线观看 | 欧美一区二区三区视频在线播放 | 亚洲成在线观看 | japanhdxxxx裸体| 欧美在线色 | 国产精品日韩欧美一区二区三区 | 国产免费一区 | 日日做夜夜爽毛片麻豆 |