nodejs / node-v0.x-archive

Moved to https://github.com/nodejs/node
34.44k stars 7.3k forks source link

Feature request: node.exe to unpack and run scripts attached to the tail of the binary #2327

Closed Mithgol closed 11 years ago

Mithgol commented 12 years ago

JSDB engine, based on Mozilla SpiderMonkey, can be used to produce «standalone» look of JavaScript applications for Windows; JSDB accepts scripts packed and attached to the tail of its jsbd.exe binary, according to the tutorial:

c:\temp>pkzip program.zip main.js
c:\temp>copy /b jsdb.exe+program.zip program.exe

I wonder if some very similar feature can be implemented in node.exe engine as well. (Of course, with index.js instead of main.js, according to Node's conventions.)

Nashev commented 12 years ago

Yes, i want this too, to make simple deployable single-exe portable app's on node.js for my users

yayscripting commented 12 years ago

Yes please :), would be wonderful!

prabirshrestha commented 12 years ago

+1 this would be awesome.

nevf commented 12 years ago

Another +1. I'd love to be able to package up Node and MongoDB and all associated JS code into a distributable executable.

ghost commented 12 years ago

+1

Mithgol commented 12 years ago

Note: there is a JavaScript MIT-licensed ZIP unpacker node-zip, based on JSZip.

However, those modules could not be merged into Node's core to fix this issue, because that would require signing the CLA from all of those modules' authors, and that I cannot imagine.

matthewkastor commented 11 years ago

It would be nice to have something like this. I've been playing with JSDB this afternoon and found this feature request because I had the same idea "this would be fun to fuck with on node". :D

I saw some other hacks around the web but people always complained that they couldn't mash their entire project (with modules and all) into the executable. This is what would be ideal, some magical compiler to generate a single executable...

There was an embedder project for php too http://wildphp.free.fr/wiki/doku.php?id=win32std:embeder where I suppose you could embed everything. It's just that embedded resources aren't files so the code all had to be changed...

This would be awesome though. If it would be that simple.

bnoordhuis commented 11 years ago

I have zero interest in adding that functionality to node.js core. It's fairly straightforward to implement but we're not going to. Closing.

matthewkastor commented 11 years ago

Thank you for your clear and definitive answer! :D

Mithgol commented 11 years ago

A note for future references: node-webkit engine (which adds Chromium to Node) can unpack and run applications attached to the tail of its binary. (See the manual.)

That's why, if you have some compelling necessity to make your application attached to the tail of its underlying engine, you now have a real option to run your application in a GUI window (based on node-webkit) instead of a console (based on Node without Chromium).

vicary commented 11 years ago

Windows only feature built in core, doesn't sound right to me. Mac and Linux can simply do #! /bin/env node.

Mithgol commented 11 years ago

Well, any Windows-only feature won't do any harm to Mac and Linux users because, obviously, it won't be built in Mac and Linux versions where unnecessary.

indutny commented 11 years ago

The thing is that we a trying to avoid doing platform-specific changes in node.js where possible. Every platform-specific code goes to libuv, and I don't see any place for this API in it.

matthewkastor commented 11 years ago

@indutny That is a great policy! :D A quick look inside any of the programs in my program files folder reveals that pretty much every application consists of more than a single executable file! :O Oh the horror! The horror! Even my node installation has a node_modules subfolder! :O

rodrigoalvesvieira commented 11 years ago

@indutny :+1: