Skip to content

Instantly share code, notes, and snippets.

View Jakiboy's full-sized avatar
🖥️
Keyboarding from 127.0.0.1

Jakiboy Jakiboy

🖥️
Keyboarding from 127.0.0.1
View GitHub Profile
@tvaliasek
tvaliasek / main.js
Created June 5, 2018 20:09
electron axios stream download with progress
import {ipcMain} from 'electron'
const fs = require('fs')
const axios = require('axios')
/* ... */
ipcMain.on('downloadFile', function (event, data) {
const filePath = data.filePath
const item = data.item
@damieng
damieng / download-with-fetch.flow.js
Last active April 13, 2023 01:17
Download a file with progress indication using just window.fetch + node (FlowType version)
// @flow
import fs from 'fs';
// Public: Download a file and store it on a file system using streaming with appropriate progress callback.
//
// * `sourceUrl` Url to download from.
// * `targetFile` File path to save to.
// * `progressCallback` Callback function that will be given a {ByteProgressCallback} object containing
// both bytesDone and percent.