Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Embed files #93

Merged
merged 3 commits into from
Feb 1, 2015
Merged

Embed files #93

merged 3 commits into from
Feb 1, 2015

Conversation

LorenzGardner
Copy link
Contributor

Add support for embedded files.

provided an array or resource files to embed nexe will now base64 encode the files into strings in a new module nexeres. From inside your application doing a require('nexeres').keys() will give you back an array of all the embedded files. and require('nexeres').get(fileName) will give you back the given file.

They fileName is a string match, and to the relative path from the resource root dir. The hello world example has been changed to embed the message.txt file as an example.

I tested this with a web server that added 125 static files as embedded files. Performance was good, but then again total memory foot print was less than 3mb. I would expect things to go bad if you tried to embed say a large video file.

If you still want to run your app as normal node app you will need to wrap a require('nexeres') in a try catch statement and when not present use fs.readFileSync to get the data.

@LorenzGardner
Copy link
Contributor Author

Addresses issues: #77

@jaredallard
Copy link
Member

Love the idea of using res in this, I'll check this out later and make sure it doesn't create any issues. However from how it looks, a breif skim, it should be fine. Thanks for the work!

@jaredallard
Copy link
Member

Works great!

jaredallard pushed a commit that referenced this pull request Feb 1, 2015
@jaredallard jaredallard merged commit 3ca6bbb into nexe:master Feb 1, 2015
@LorenzGardner LorenzGardner deleted the embedFiles branch February 9, 2015 21:59
jaredallard pushed a commit that referenced this pull request Jan 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants