I have a function NodeJS application which converts video files and puts them in a 'converted' directory. I am using the express, http and multer modules. The problem I'm having is downloading the completed videos. Shouldn't I be able to see, load the completed video in a browser if I simply point to it?
ie when I enter the following
http://localhost:8080/converted/converted.avi
I get
Cannot GET /converted/converted.avi
The complete header portion of my node app is
var express = require('express');
var app = express();
var multer = require('multer'),
fs = require('fs'),
ffmpeg = require('./lib/fluent-ffmpeg');
var server = require('http').createServer(app);
var io = require('socket.io').listen(server,{transports:['flashsocket', 'websocket', 'htmlfile', 'xhr-polling', 'jsonp-polling']});
var port = Number(8080);
server.listen(port);
app.use(multer({ dest: './uploads/'}));
Probably not relevant since there are other issues at play but this is the actual code I am using for an Adobe AIR client to do the actual downloading
(reference http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/URLLoader.html)
_urlLoader = new URLLoader();
_urlLoader.dataFormat = URLLoaderDataFormat.BINARY;
_urlLoader.addEventListener(Event.COMPLETE,
function(e:Event):void
{
var air:File = File.desktopDirectory.resolvePath("converted.mp4");
//var file:File = File.desktopDirectory.resolvePath("AIR Test");
var fs:FileStream = new FileStream();
fs.open(air, FileMode.WRITE);
fs.writeBytes(_urlLoader.data);
fs.close();
air.downloaded = true;
});
Using the following simple setup for express to serve a static directory SHOULD work but
var express = require('express');
var app = express();
console.log('static and __dirname = '+__dirname)
app.use(express.static(__dirname+'/public'));
app.listen(process.env.PORT || 3000);
when i drop a simple index.html in the server public folder I still only get the following in a browser...
Cannot GET /public/index.html