Library:NW.js
| On this wiki | Facts · Code · Notes · Topics |
|---|
NW.js (formerly node-webkit, MIT) runs a Chromium plus Node.js application from a package.json; RPG Maker MV/MZ and many HTML5 games ship as nw.exe next to package.json, a package.nw folder or ZIP, or a ZIP appended to the executable.
NW.js (formerly node-webkit) is a runtime that combines Chromium and Node.js; an application is a web app described by a package.json manifest. Source: the project's own docs/ folder (nwjs/nw.js, MIT). Compare Library:Electron, which packs its app in Format:ASAR archive (Electron).
Package layouts
Per docs/For Users/Package and Distribute.md:
- Windows/Linux, plain files: package.json sits in the same folder as nw / nw.exe, or the app is in a folder named package.nw next to the executable.
- Windows/Linux, ZIP: all app files zipped and renamed package.nw (Format:ZIP), placed beside the binaries. At start NW.js unzips it into a temp folder.
- Windows/Linux, hidden ZIP: the ZIP appended to the executable (copy /b nw.exe+package.nw app.exe, or cat nw package.nw > app). Recognise it by a ZIP end-of-central-directory record at the end of the .exe and PK local headers after the PE image.
- macOS: the app lives in nwjs.app/Contents/Resources/app.nw (a folder, or a ZIP named app.nw).
- The SDK flavor additionally contains nwjc, payload and chromedriver, which are not meant to be shipped; process.versions['nw-flavor'] tells the flavor at run time.
Manifest (package.json)
Required fields are main (the page opened at start, e.g. index.html) and name. Other documented fields include window (title, width, height, icon...), nodejs, node-main, node-remote, chromium-args, js-flags, bg-script, inject_js_start/inject_js_end, product_string and domain (References/Manifest Format.md). chromium-args and node-remote are worth reading first in a game: they show enabled switches and which origins get Node access.
Compiled JavaScript (nwjc)
The SDK tool nwjc source.js binary.bin compiles JavaScript to V8 native code; the app loads it with nw.Window.get().evalNWBin(frame, 'binary.bin') (evalNWBinModule for modules built with --nw-module; importNWBin in workers). Per the docs the output is not cross-platform and not compatible between NW.js versions. Such .bin files are why a package may contain no readable .js: see Technique:Reversing bundled JavaScript and Library:V8. Unverified: the binary header layout of nwjc output is not documented in the docs.
Seen in
Library:RPG Maker MV and MZ games. Utils.isNwjs() in the MV core scripts is typeof require === 'function' && typeof process === 'object'.
Code & repositories
See the linked repository.
- https://github.com/nwjs/nw.js @
a8dd19958f03536d0bc2a3e584e7decbef307157· license: MIT
NW.js (MIT): docs/For Users/Package and Distribute.md, docs/References/Manifest Format.md, docs/For Users/Advanced/Protect JavaScript Source Code.md.
Tested on: source read, not run: source read, not run · checked 2026-10-18; last activity 2026-10-17