From a browser, I would like to ask the server if a file that has been selected in a file input is identical to the one that it would replace on the server, if sent in a PUT request. I would use this comparison to decide whether or not to enable a save button.
To do that, I figure I should generate an ETag for the blob and then compare that with the ETag header returned by a HEAD request for that resource.
My question is, is there a browser API call that will return an ETag for a file-like object?
Rough idea:
<input type="file" onchange="function( event ) {
console.log( ETagUnicorn.generate( event.target.files[0] ));
}" />