I am using NuxtJS's AsyncData method to fetch a video file from an API and then return to the page as a file object.
Like so:
async AsyncData({$axios}){
var user_video = null;
try{
var video = $axios.get("my awesome url");
user_video = new File([video], "video.mp4",{type:"video/mp4"}); // <= this line
}catch(error){
console.log(error);
console.log("no saved video");
}
return {user_video};
}
In in the server side console, it shows this error:
ReferenceError: File is not defined
at asyncData (pages/send/video.js:155:11)
at process._tickCallback (internal/process/next_tick.js:68:7)
no saved video
I've looked at other nuxtjs Content keys to use that may have something to do with creating a new File Object, but i have not found any. https://nuxtjs.org/api/context
I've tried searching for a similar error with using the File object in asyncdata, though I have not found anything.
Any suggestions?
Edit ---- Also To Add:
the URL I am fetching from brings to a download dialogue box in case this may be related.