Stream uploads + downloads + allow for remote url uploads

- Switch to using got
- Use encryption/decryption streams for speed & lesser memory consumption
- Allow for stream based download & simultaneous upload of media
This commit is contained in:
Adhiraj Singh
2021-01-13 22:48:28 +05:30
parent 500805236a
commit 0344d6336c
19 changed files with 501 additions and 146 deletions

View File

@@ -33,10 +33,10 @@ export class WAConnection extends Base {
isOnWhatsAppNoConn = async (str: string) => {
let phone = str.split('@')[0]
const url = `https://wa.me/${phone}`
const response = await this.fetchRequest(url, 'GET', undefined, undefined, undefined, 'manual')
const loc = response.headers.get('Location')
const response = await this.fetchRequest(url, 'GET', undefined, undefined, undefined, false)
const loc = response.headers['Location'] as string
if (!loc) {
this.logger.warn({ url, status: response.status }, 'did not get location from request')
this.logger.warn({ url, status: response.statusCode }, 'did not get location from request')
return
}
const locUrl = new URL('', loc)