Can I assume that Mac OS X clipboard image data is png?
When I try to MIME-detect the clipboard data, it returns application/octet
.
This has the undesirable effect of causing every browser to download the image rather than display it.
If I force the content-type to image/png, everything seems fine, but I wondered if there is a way for me to not have to make the assumption?
$log.debug(e.originalEvent.clipboardData);
for (var i = 0; i < e.originalEvent.clipboardData.items.length; i++) {
var item = e.originalEvent.clipboardData.items[i];
$log.info("Item type: " ,item);
if (item.type.indexOf("image") != -1) {
$scope.token.images = [];
$log.debug(item.getAsFile(), {});
...
I use https://github.com/broofa/node-mime to detect MIME types.