Electron - Download a file to a specific location

后端 未结 3 1500
滥情空心
滥情空心 2021-01-31 06:33

I need to download a file to a specific location in my Electron program.
I tried implementing this API but failed.
Then I tried implementing the official API, but couldn

3条回答
  •  一生所求
    2021-01-31 06:54

    as you mentioned yourself, electron-dl seems to be the popular way to do that. Mainly from the github page: npm i -S electron-dl

    const {BrowserWindow} = require('electron');
    const {download} = require('electron-dl');
    download(BrowserWindow.getFocusedWindow(), "http://url-to-asset", {directory:"c:/Folder"})
    

提交回复
热议问题