#What's the best way to download remote content and store it locally?

3 messages · Page 1 of 1 (latest)

eternal crystal
#

I have some images stored remotely that I would like to download first to import them as a locally stored images to benefit from better image optimizations and more. Is there a handy way to realize that with content collections?

vague ermineBOT
#

Hi @eternal crystal. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

The knowledge sources only describe how Astro uses local vs. remote images; they do not describe any built‑in way to download remote images and persist them locally, nor any integration of such a workflow with content collections. [Images guide]

From the docs:

  • Astro can:
    • Use local images from src/ (optimized) or public/ (served as‑is). [Images guide]
    • Use remote images directly by URL, and can process them if they are from authorized remote sources. [Images guide]
  • But there is no mention of:
    • A built‑in “download and cache remote images to disk” feature.
    • A content‑collections API that automatically fetches remote images and stores them locally.

So, based on the available docs, Astro expects you to either:

  1. Keep images remote and let Astro process them (if authorized), or
  2. Manually place images in src/ or public/ if you want them treated as local. [Images guide]

There is no documented “handy way” with content collections to automatically download remote images and convert them into local imports.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: