简体   繁体   中英

How to get external resources after building node-webkit app

I'm developing a simple node-webkit app which is similar to a product catalog. So I have lots of images, around 1500!!

Currently, I'm done with implementing and using Grunt(grunt-node-webkit-builder) for building .exe. After creating an exe file, I use IExpress to make nw.exe and helper DLLs all-in one place. Because some of users doesn't like when setup looks messy. So I have two steps:

  1. Make a build with Grunt
  2. After the Grunt build, use IExpress to make it one .exe

In both cases, all the images are located in the application(around ~250MB).

My problem starts when the users clicks on the application. The time of opening application is around 30-40 seconds! I need to figure out how to decrease time!(btw, in development, it is super fast)

I thought that may be if I get images from external path and caching them make the performance better. But I don't know or I have no idea how to get images from external path after using IExpress!! Maybe there are better solutions or workaround even images are located at internal path. Could you suggest me how to solve this problem? Thanks in advance.

I had the same issue as you and i don't know if you're stuck on this or you found a solution, but searching through the NWJS google group i found this:

var path = require("path"); 
pathstr = path.dirname(process.execPath); 

This returns the path where the NW bin is running. Just treat the string to fit your case and access the external files

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM