Show BASE64 video with node/express
Streaming videos directly to/from GridFS using gridfs-stream either with mongodb-native db instance or mongoose.
var mongo = require('mongodb'), Grid = require('gridfs-stream'), db = new mongo.Db('yourDatabaseName', new mongo.Server("127.0.0.1", 27017)), gfs = Grid(db, mongo);//storeapp.post('/video', function (req, res) { req.pipe(gfs.createWriteStream({ filename: 'file_name_here' })); res.send("Success!");});//getapp.get('/video/:vid', function (req, res) { gfs.createReadStream({ _id: req.params.vid // or provide filename: 'file_name_here' }).pipe(res);});
for complete files and running project:
Clone node-cheat direct_upload_gridfs, run node app
followed by npm install express mongodb gridfs-stream
.
Truly an odd problem...
I could be way off, but it's worth a shot:
One of the differences when opening a url directly from the browser is that the browser will also try to fetch http://localhost:8080/favicon.ico
(while trying to find the tab icon). Maybe the problem is not related to your video code, but rather to some other route, trying to handle the /favicon.ico
request?
Have you tried using wget
or curl
?