#passenger princess

3 messages · Page 1 of 1 (latest)

dusty oyster
#

const glob = import.meta.glob("../../../node_modules/katex/dist/fonts/*", {
query: "?raw",
import: "default",
});

but i want the bytes not string 😦

bleak citrusBOT
#

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

#

I'm sorry, but the knowledge sources do not contain information about using import.meta.glob() to import files as raw bytes (e.g., as ArrayBuffer) in Astro. The documentation does mention that, for Cloudflare Workers, importing .bin files will export an ArrayBuffer of the raw binary contents, but this is specific to the Cloudflare integration and not general usage of import.meta.glob() or the ?raw query, which returns a string, not bytes Cloudflare Module Imports.

For general Astro and Vite usage, the ?raw suffix imports the file as a string, and there is no documented way in the provided sources to import files as bytes using import.meta.glob() or a similar mechanism. If you need this functionality, you may need to look for a Vite or Node.js-specific solution outside of what is documented for Astro.

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