Working with Files and Bytes
JS uses special structures for handling images, video, or network protocols.
1. ArrayBuffer
This is simply a chunk of memory filled with bytes. You cannot work with it directly. To " read " it, you need TypedArrays (Uint8Array, etc.).
2. Blob (Binary Large Object)
This is an object representing data as a file (an image, a PDF). Blobs are often used for uploading/downloading files.
const blob = new Blob(["Hello, world!"], {type: 'text/plain'});
Tip
You can create a link to a Blob using URL.createObjectURL(blob) to use it in <img> or <a> tags.