# Load application resources and avoid runtime package surprises

> Run LOAD in a separate process and verify NPMINSTALL reuse of an already available package without network access.

Framework: total5
Product: Total.js 5 (total5@0.0.19)
Language: en
Content-SHA256: b0349301366b0df42a87c482e3d35d66cf8cc6fa1505cc377a34aea6d934523f
Snapshot: c0700e321579725c5cf4f5ace1ad7d2866d1b4f93c24a63c0b41b6b7998e976c
Sources: total5-installed@total5@0.0.19
Review: not-recorded

`LOAD(types, [callback], [clear=true])` is the application loader. `types` is an array or comma-separated list of resource groups (such as `config`, `definitions`, `controllers`, `actions`, `modules`, `resources`, `jsonschemas`, `flowstreams`). With no list it loads the normal application groups. It extracts bundles first and clears temporary files by default. Use it in a standalone script when you need application definitions without starting an HTTP listener; do not repeatedly call it in a request handler.

`NPMINSTALL(name, [callback])` checks the package under `CONF.$nodemodules`: an already-installed matching version returns without running npm. Otherwise it invokes `npm install` there. The name must be a trusted fixed application value, never request input. Deploy dependencies through a pinned package manifest/lockfile when reproducibility matters. The test below covers only the installed-package branch: it does not download, upgrade or certify any third-party package.

```js controllers/loading.js
exports.install = function() {
	ROUTE('GET /loader-contract/', function($) { $.json({ available: typeof LOAD === 'function' && typeof NPMINSTALL === 'function' }); });
};
```
