code: function drawToCanvas({data, width, height}) {
    if (typeof document === 'undefined') return null
  
      var canvas = document.createElement('canvas')
      canvas.width = width
      canvas.height = height
      var context = canvas.getContext('2d')
      var idata = context.createImageData(canvas.width, canvas.height)
      for (var i = 0; i < data.length; i++) {
        idata.data[i] = data[i]
      }
      context.putImageData(idata, 0, 0)
      return canvas
  }
docs: draw buffer on the canvas