Add support for embedded files.
This commit is contained in:
@@ -3,10 +3,11 @@ var nexe = require('nexe');
|
||||
nexe.compile(
|
||||
{
|
||||
input: "./index.js",
|
||||
output: "./hellowWord.exe",
|
||||
output: "./helloWorld.exe",
|
||||
nodeVersion: "0.10.33",
|
||||
nodeTempDir: "",
|
||||
flags: true
|
||||
flags: true,
|
||||
resourceFiles: ["./message.txt"]
|
||||
},
|
||||
function (err) {
|
||||
if (err) {
|
||||
|
||||
@@ -1,18 +1,23 @@
|
||||
var http = require("http"),
|
||||
fs = require("fs"),
|
||||
path = require("path"),
|
||||
nexeres = require("nexeres"),
|
||||
childProc = require("child_process"),
|
||||
port = 1337;
|
||||
|
||||
//Fork a new process to execute the broser.js
|
||||
var childProc = require("child_process");
|
||||
childProc.fork("./browser.js");
|
||||
childProc.fork(path.join(__dirname, "browser.js"));
|
||||
if (false) {
|
||||
require("./browser.js"); //force the bundler to include the .js file
|
||||
require("./browser.js"); //force the bundler to include the .js file
|
||||
}
|
||||
|
||||
//start a web server on specified port (or default if non given)
|
||||
//start a web server on specified port (or default if not given)
|
||||
console.log("started HTTP server on port %d", port = Number(process.argv.concat().pop()) || port);
|
||||
|
||||
http.createServer(function(req, res) {
|
||||
fs.createReadStream(path.join(process.cwd(), "message.txt")).pipe(res);
|
||||
}).listen(port);
|
||||
//return the embeded file in response to any request
|
||||
|
||||
res.write(nexeres.get("message.txt"));
|
||||
|
||||
res.end();
|
||||
}).listen(port);
|
||||
|
||||
Reference in New Issue
Block a user