I have an electron app that gets some videos from the web and stores them local so that they run instantly when the main app runs, so that the videos can be updated externally, but the video is garbled.
I have tried this code:
var file = js.node.Fs.createWriteStream('savedVideo.mp4');
var cb = function(){ screenLog( 'videoSaved'); };
file.end( cb );
var url = 'http://somewhereonweb.com/video.mp4';
var request = Http.get( url, function(response) {
response.pipe( file );
}
( not sure how I atttach an error ).
This saves a file locally but it's probably saved as utf8 so it is no longer a video.
I found that there is a binary option in an older node js lib.
https://github.com/dionjwa/nodejs-std/blob/master/haxe/HttpEncoding.hxbut I am not sure if I should resort to that instead the haxe folder seems to be missing in the official repository.
https://github.com/HaxeFoundation/hxnodejs/tree/master/srcSeems the normal Haxe approach would be something like
var http = new haxe.Http( url );
but no way to set binary and in the onData I can't set the pipe.
I am using nightly Haxe, I could switch to neko for just the streaming videos to a file if it's simpler, not sure how to proceed.