This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function callAsync(fn) { | |
// get iterator | |
var iterator = fn(); | |
// used as a callback to currently yielded functions | |
function next() { | |
// get next function | |
var current = iterator.next(); | |
// recursion exit condition |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var formData = { | |
'myfile_key': { | |
value: <Buffer object> | |
options: { | |
filename: 'image_file' | |
} | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import http from 'http'; | |
import axios from 'axios'; | |
http.createServer(async function (req, res) { | |
const responseStream = await axios({ | |
method: 'get', | |
url: 'http://blob.file.storage/filepath', | |
responseType: 'stream' | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const axios = require('axios'); | |
const fs = require('fs'); | |
const url = <path_to_file> | |
axios({ | |
method: 'get', | |
url: url, | |
responseType:'stream' | |
}) | |
.then(res => { | |
res.data.pipe(fs.createWriteStream('new.zip')); |
OlderNewer