How to Use Nuxt to Download a File from Sanity

2 replies
Last updated: Mar 26, 2021
Hello! using nuxt, how can i download a file from sanity? πŸ™‚
Mar 26, 2021, 3:05 PM
Something like this should work from any framework, including Nuxt. The same parameter will work with assets , too.
Mar 26, 2021, 3:18 PM
Yes! i did it something like this:

const [_file, id, extension] = ref.split('-');
return `<https://cdn.sanity.io/files/${this.sanityConfig.projectId}/${this.sanityConfig.dataset}/${id}.${extension}>`;
Mar 26, 2021, 3:19 PM

Sanity.io – build remarkable experiences at scale

Sanity is a customizable solution that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Categorized in