File{name:'filename',size:1898921,// other properties}
But doing
console.log(JSON.stringify(someFile))
will result in:
{}
With no properties. I've noticed that it does this for object spread as well so if you wanted to copy File info, you can't just do: { ...someFile }, you'll need to call and pick out the individual properties manually.
Encountered this one yesterday and spent a day on it.
A
File
object cannot be serialized into JSON. There's a StackOverflow question about it.But essentially if you do
The browser will happily return something like:
But doing
will result in:
With no properties. I've noticed that it does this for object spread as well so if you wanted to copy File info, you can't just do:
{ ...someFile }
, you'll need to call and pick out the individual properties manually.This made my day 😂