Created
April 28, 2023 11:39
-
-
Save woss/c582a067b3b06e8f99d9b37f2468f64f to your computer and use it in GitHub Desktop.
Revisions
-
woss created this gist
Apr 28, 2023 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ import axios from "axios"; import FormData from "form-data"; // create DL stream const dl = await axios.get('url.tar', { responseType: "stream", }); // create multipart const formData = new FormData(); formData.append('file', dl.data); // directly proxy the stream to the upstream const up = await axios({ method: 'POST', url: `upstream-url/api/post/add`, data: formData, maxContentLength: Infinity }); console.log(up.data)