JavaScript Blob : Object
Blobs are immutable objects that represent raw data. File is a derivation of Blob that represents data from the file system. Use FileReader to read data from a Blob or File. Blobs allow you to construct file like objects on the client that you can pass to apis that expect urls instead of requiring the server provides the file. For example, you can construct a blob containing the data for an image, use
URL.createObjectURL() to generate a url, and pass that url to HTMLImageElement.src to display the image you created without talking to a server.Constructors
Creates a new Blob. The elements of blobParts must be of the types ArrayBuffer, ArrayBufferView, Blob, or String. If ending is set to 'native', the line endings in the blob will be converted to the system line endings, such as '\r\n' for Windows or '\n' for Mac.
Example:
RunResults:
Instance Methods
Returns a new blob that contains the bytes start to end - 1 from this. If start or end is negative, the value is added to this.size before performing the slice. If end is not specified, this.size is used. The returned blob's type will be contentType if specified, otherwise it will be ''.
Example:
RunResults:
Copyright © JavaScripture Contributors