Copy Image in Clipbaord to Electron App

·

1 min read

TL;DR

This function returns a code of image source.

const copyImage = () => {
  const _ = clipboard.availableFormats('clipboard')
  if (_.includes('image/png') || _.includes('image/jpeg')) {
    return clipboard.readImage('clipboard').toDataURL()
  }
  else return false
}

I referred to this web page.