import aiohttp


async def download_file(slack_api_token, file):
    """Downloads a file from slack into memory and returns the raw bytes."""
    headers = {'Authorization': 'Bearer {}'.format(slack_api_token)}
    async with aiohttp.ClientSession() as session:
        async with session.get(file["url_private"], headers=headers) as resp:
            return await resp.read()