downloadMedia = async (message, pathFile) => {
    const type = Object.keys(message)[0];
    try {
        const stream = await downloadContentFromMessage(message[type], mimeMap[type]);
        const buffer = [];
        for await (const chunk of stream) {
            buffer.push(chunk);
		}
        if (pathFile) {
            await fs.promises.writeFile(pathFile, Buffer.concat(buffer));
            return pathFile;
        } else {
            return Buffer.concat(buffer);
        }
    } catch (e) {
        console.log(message)
        throw e;
    }
}
Download the media from the message.
@param {import("@whiskeysockets/baileys").proto.IMessage} message - The message object.
@param {string} type - The media type.
@returns {Promise<Buffer>} - The media buffer.