mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Changed concat to push
This commit is contained in:
committed by
Adhiraj Singh
parent
c76c2afa0c
commit
4f1d9492c5
@@ -330,12 +330,12 @@ export const extractSyncdPatches = async(result: BinaryNode) => {
|
|||||||
|
|
||||||
export const downloadExternalBlob = async(blob: proto.IExternalBlobReference) => {
|
export const downloadExternalBlob = async(blob: proto.IExternalBlobReference) => {
|
||||||
const stream = await downloadContentFromMessage(blob, 'md-app-state')
|
const stream = await downloadContentFromMessage(blob, 'md-app-state')
|
||||||
let buffer = Buffer.from([])
|
const bufferArray: Buffer[] = []
|
||||||
for await (const chunk of stream) {
|
for await (const chunk of stream) {
|
||||||
buffer = Buffer.concat([buffer, chunk])
|
bufferArray.push(chunk)
|
||||||
}
|
}
|
||||||
|
|
||||||
return buffer
|
return Buffer.concat(bufferArray)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const downloadExternalPatch = async(blob: proto.IExternalBlobReference) => {
|
export const downloadExternalPatch = async(blob: proto.IExternalBlobReference) => {
|
||||||
|
|||||||
@@ -11,11 +11,13 @@ const inflatePromise = promisify(inflate)
|
|||||||
|
|
||||||
export const downloadHistory = async(msg: proto.Message.IHistorySyncNotification) => {
|
export const downloadHistory = async(msg: proto.Message.IHistorySyncNotification) => {
|
||||||
const stream = await downloadContentFromMessage(msg, 'history')
|
const stream = await downloadContentFromMessage(msg, 'history')
|
||||||
let buffer = Buffer.from([])
|
const bufferArray: Buffer[] = []
|
||||||
for await (const chunk of stream) {
|
for await (const chunk of stream) {
|
||||||
buffer = Buffer.concat([buffer, chunk])
|
bufferArray.push(chunk)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let buffer = Buffer.concat(bufferArray)
|
||||||
|
|
||||||
// decompress buffer
|
// decompress buffer
|
||||||
buffer = await inflatePromise(buffer)
|
buffer = await inflatePromise(buffer)
|
||||||
|
|
||||||
|
|||||||
@@ -702,12 +702,12 @@ export const downloadMediaMessage = async(
|
|||||||
|
|
||||||
const stream = await downloadContentFromMessage(media, mediaType, options)
|
const stream = await downloadContentFromMessage(media, mediaType, options)
|
||||||
if(type === 'buffer') {
|
if(type === 'buffer') {
|
||||||
let buffer = Buffer.from([])
|
const bufferArray: Buffer[] = []
|
||||||
for await (const chunk of stream) {
|
for await (const chunk of stream) {
|
||||||
buffer = Buffer.concat([buffer, chunk])
|
bufferArray.push(chunk)
|
||||||
}
|
}
|
||||||
|
|
||||||
return buffer
|
return Buffer.concat(bufferArray)
|
||||||
}
|
}
|
||||||
|
|
||||||
return stream
|
return stream
|
||||||
|
|||||||
Reference in New Issue
Block a user