feat: add desktop repo (#1071)

This commit is contained in:
Mo
2022-06-07 11:52:15 -05:00
committed by GitHub
parent 0bb12db948
commit 0b7ce82aaa
135 changed files with 17821 additions and 180 deletions

View File

@@ -0,0 +1,22 @@
import { WriteStream } from 'fs'
import axios, { AxiosResponseHeaders, AxiosRequestHeaders } from 'axios'
export async function downloadData(
writeStream: WriteStream,
url: string,
headers: AxiosRequestHeaders,
): Promise<{
headers: AxiosResponseHeaders
status: number
}> {
const response = await axios.get(url, {
responseType: 'arraybuffer',
headers: headers,
})
if (String(response.status).startsWith('2')) {
writeStream.write(response.data)
}
return { headers: response.headers, status: response.status }
}