title: Convert Blob to binary string synchronously
body: <p>I'm trying to put image in clipboard when user copies canvas selection:</p>
  
  <p><img src="https://i.stack.imgur.com/rVPxO.png" alt="canvas selection"></p>
  
  <p>So I thought the right way would be to convert canvas tu dataURL, dataURL to blob and blob to binary string.</p>
  
  <p>Theoretically it should be possible to skip the blob, but I don't know why.</p>
  
  <p>So this is what I did:</p>
  
  <pre><code>  function copy(event) {
      console.log("copy");
      console.log(event);
  
      //Get DataTransfer object
      var items = (event.clipboardData || event.originalEvent.clipboardData);
      //Canvas to blob
      var blob = Blob.fromDataURL(_this.editor.selection.getSelectedImage().toDataURL("image/png"));
      //File reader to convert blob to binary string
      var reader = new FileReader();
      //File reader is for some reason asynchronous
      reader.onloadend = function () {
        items.setData(reader.result, "image/png");
      }
      //This starts the conversion
      reader.readAsBinaryString(blob);
  
      //Prevent default copy operation
      event.preventDefault();
      event.cancelBubble = true;
      return false;
    }
    div.addEventListener('copy', copy);
  </code></pre>
  
  <p>But when the <code>DataTransfer</code> object is used out of the <code>paste</code> event thread the <code>setData</code> has no longer any chance to take effect.</p>
  
  <p>How can I do the conversion in the same function thread?</p>