javascript - Save file automatically from IFrame in Node Webkit -


i using node-webkit automate common tasks. have iframe goes site address, clicks save , have file save dialog pop out.

is there way can catch event save file witout requiring external action (like setting save folder , clicking on save)?

you may not able way, have thought doing http request node's http module? that's beauty of using node-webkit, use node.js!

var http = require('http');  var fs = require('fs');  var path = require('path');    var savelocation = path.join(__dirname, "/cache", "file.txt");    //the url want is: 'www.random.org/integers/file.txt'  var options = {    host: 'www.random.org',    path: '/integers/file.txt'  };    callback = function(response) {    var str = '';      //another chunk of data has been recieved, append `str`    response.on('data', function (chunk) {      str += chunk;    });      //the whole response has been recieved, print out here    response.on('end', function () {      console.log(str);      fs.writefile(savelocation, str, function (err) {        if (err) console.log("problem saving file.");      });    });  }    // send request.  http.request(options, callback).end();


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -