How to set background image of windows desktop from running electron app?


I want to set background image of desktop from electron app.
I have a image hosted on server and i will display list of images and users can set that image after right click on to it.
How to achieve that?

This is what i am using it while creating window just to make sure that it is working.

function createWindow () {
  win = new BrowserWindow({width: 800, height: 600})
    pathname: path.join(__dirname, 'index.html'),
    protocol: 'file:',
    slashes: true
    var download = function(uri, filename, callback){
    request.head(uri, function(err, res, body){
      console.log('content-type:', res.headers['content-type']);
      console.log('content-length:', res.headers['content-length']);

      request(uri).pipe(fs.createWriteStream(filename)).on('close', callback);

  download('', 'google.png', function(){
      console.log("image set");