Hey,
I am trying to download a file using nodejs and I am facing a bit of an odd problem.
I started from the CEP_HTML_Test_Extension
in the nodejs.html I changed isNodeJSEnabled to the following (the code below works):
function isNodeJSEnabled() {
var https = window.cep_node.require('https')
var fs = window.cep_node.require('fs')
var url = "https://upload.wikimedia.org/wikipedia/commons/4/4f/Big%26Small_edit_1.jpg"
var fullPath = "C:\\premiereTest\\6\\abcde.jpg";
var file = fs.createWriteStream(fullPath);
var request = https.get(url, function (response) {
response.pipe(file);
// ensure file is complete before importing
response.on('end', function () {
});
});
}
and as I said this code works.
but when I take the same code put it in my real website
and changed the index.html in CEP_HTML_Test_Extension to just reload my site i.e(window.location.replace("https://test.MyRealWebsite.io/")).
then the same code doesn't work, it creates the file so the createWriteStream works. but the https.get does nothing, I tried to check error callbacks as well but nothing is been called, nor does the success, just nothing.
any ideas?
thanks.