Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Allow options to be passed to vidStreamer

while still allowing config/vidStreamer.json to be used

Closes #3
  • Loading branch information...
commit 84a5177df10d12900ff3516847bb157a03305235 1 parent b58aee0
Will Laurance authored

Showing 2 changed files with 11 additions and 4 deletions. Show diff stats Hide diff stats

  1. +4 2 README.md
  2. +7 2 index.js
6 README.md
Source Rendered
@@ -9,7 +9,7 @@ To make a standalone video streamer, try something like this
9 9 var http = require("http");
10 10 var vidStreamer = require("vid-streamer");
11 11
12   -var app = http.createServer(vidStreamer);
  12 +var app = http.createServer(vidStreamer());
13 13 app.listen(3000);
14 14 console.log("VidStreamer.js up and running on port 3000");
15 15 ```
@@ -20,7 +20,7 @@ And here's an example of including it in an Express app
20 20 var app = require("express").createServer();
21 21 var vidStreamer = require("vid-streamer");
22 22
23   -app.get("/videos/", vidStreamer);
  23 +app.get("/videos/", vidStreamer());
24 24
25 25 app.listen(3000);
26 26 ```
@@ -55,6 +55,8 @@ Standalone example
55 55 }
56 56 ```
57 57
  58 +You may also pass in a js object to vidStreamer(options);
  59 +
58 60 Example for Express. (Note that rootPath should be relative to the root URL of your Express app.)
59 61
60 62 ```javascript
9 index.js
@@ -11,7 +11,7 @@
11 11 var fs = require("fs");
12 12 var url = require("url");
13 13 var events = require("events");
14   -var settings = require("konphyg")(__dirname + "/config/")("vidStreamer");
  14 +var settings = {};
15 15
16 16 var handler = new events.EventEmitter();
17 17
@@ -314,4 +314,9 @@ handler.on("noRandomFiles", function (res, e) {
314 314 util.debug(e);
315 315 });*/
316 316
317   -module.exports = vidStreamer;
  317 +module.exports = function(options){
  318 + settings = options;
  319 + if(typeof(options) === 'undefined')
  320 + settings = require("konphyg")(__dirname + "/config/")("vidStreamer");
  321 + return vidStreamer;
  322 +}

0 comments on commit 84a5177

Please sign in to comment.
Something went wrong with that request. Please try again.