What I have discovered so far, looking at the source code of Firefox: ( I still need to get confirmation! )
Blob objects are instances of the nsDOMFile subclasses. The implementation is wise, there are few differences between Blob and file. They are either nsDOMFileFile , nsDOMMemoryFile , nsDOMTemporaryFileBlob , or nsDOMMultipartFile .
Mostly nsDOMMemoryFile places are used only:
- In
HTMLCanvasElement#toBlob . - In the camera API.
- In the Media Recorder API.
- In WebSockets, when
binaryType is 'blob' . - In WebRTC data channels, when
binaryType is 'blob' .
All other places use nsDOMFileFile or nsDOMTemporaryFileBlob and are thus supported by disk storage, with the exception of the new Blob constructor.
Beans created using the new Blob constructor are instances of nsDOMMultipartFile . This class actually wraps the blob set (from the other three types described above) and represents them as one.
When passing a string or ArrayBuffer, they are copied to the new nsDOMMemoryFile , and then attached to the set. When transferring an existing Blob of any type, it is added to the set as is. Thus, nsDOMMultipartFile can have mixed memory and memory.
source share