Quantcast
Channel: Adobe Community : Popular Discussions - Premiere Pro SDK
Viewing all articles
Browse latest Browse all 53010

Downloading file with NodeJS in CEP extension

$
0
0

I'm trying to get file downloading with NodeJS working in my CEP extension for Premiere Pro CC 2015. I have the following script:

 

var http = require('http');
var fs = require('fs');
var file = fs.createWriteStream("file.jpg");
var request = http.get("http://i3.ytimg.com/vi/J---aiyznGQ/mqdefault.jpg", function(response) {    response.pipe(file);
});

 

The script works perfectly well if I run it on it's own. For example, if I put it in a file called test.js, and run node test.js in terminal, it successfully saves the image to the same directory the script is in.

 

When I include it in my CEP extension, however, nothing happens. The script executes without errors, but no file is downloaded anywhere. Even if I try:

try {     response.pipe(file);     alert("File downloaded");
} catch(e) {     alert(e);
}

 

The "File downloaded" alert pops up. So the lack-of-download doesn't seem to be from an error in the code, but perhaps in the way CEP works itself? I'm at a loss. Any suggestions?

 

Thanks!


Viewing all articles
Browse latest Browse all 53010

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>