[whatwg] Proposing <canvas>.toBlob(contentType)

David Levin levin at chromium.org
Wed Apr 13 15:37:59 PDT 2011


Shouldn't this api be async?

Returning a blob means that the size is available which implies a sync
operation.

dave

On Wed, Apr 13, 2011 at 3:02 PM, Kyle Huey <me at kylehuey.com> wrote:
> Hello All,
>
> Gecko 2.0 ships with a non-standard method on <canvas> named
> mozGetAsFile(contentType, fileName).  We added this for internal use in our
> UI.  It retrieves the contents of the canvas as a File object (at the time
> Gecko did not supports Blobs) encoded in the contentType according to the
> same rules toDataURL uses.
>
> I propose adding a toBlob(contentType) method to the canvas element in the
> style of toDataURL.  This would greatly increase the options available to
> developers for extracting data from a canvas element (a Blob can be saved to
> disk, XHRed, etc.)
>
> - Kyle
>


More information about the whatwg mailing list