Usage
Installation
npm install @nx.js/install-titlepnpm add @nx.js/install-titleyarn add @nx.js/install-titlebun add @nx.js/install-titleSupported Formats
| Format | Description |
|---|---|
| NSP | Nintendo Submission Package (PFS0) |
| NSZ | Compressed NSP (contains NCZ-compressed NCAs) |
| XCI | GameCard Image (HFS0 partitions) |
| XCZ | Compressed XCI (contains NCZ-compressed NCAs) |
Example
import { install } from '@nx.js/install-title';
import { NcmStorageId } from '@nx.js/ncm';
// Open a file from the SD card
const file = Switch.file('sdmc:/game.nsp');
// Install to SD card — format is auto-detected from magic bytes
for await (const step of install(file, NcmStorageId.SdCard)) {
switch (step.type) {
case 'start':
console.log(`Starting: ${step.name}`);
break;
case 'end':
console.log(
`Done: ${step.name} (${(step.timeEnd - step.timeStart).toFixed(0)}ms)`,
);
break;
case 'progress':
console.log(`${step.name}: ${step.processed}/${step.total}`);
break;
}
}
console.log('Installation complete!');All four formats work the same way — just point at the file:
// NSP, NSZ, XCI, and XCZ are all auto-detected
const nsz = Switch.file('sdmc:/game.nsz');
const xci = Switch.file('sdmc:/game.xci');
const xcz = Switch.file('sdmc:/game.xcz');
for await (const step of install(nsz, NcmStorageId.SdCard)) {
// ...
}You can also specify the format explicitly:
for await (const step of install(blob, NcmStorageId.SdCard, { format: 'xci' })) {
// ...
}Validation Warnings
The installer performs validation checks and emits warnings via the onWarning callback.
If no callback is provided, warnings are treated as fatal errors and abort the installation.
for await (const step of install(file, NcmStorageId.SdCard, {
onWarning: async (warning) => {
console.warn(`Warning: ${warning.message}`);
// Return true to continue, false to abort
return true;
},
})) {
// ...
}| Warning Code | Description |
|---|---|
already-installed | The exact title ID + version is already installed |
nca-already-registered | A specific NCA is already in content storage |
missing-ticket | A .tik file is missing its corresponding .cert |
How It Works
- Parse container — NSP/NSZ uses PFS0, XCI/XCZ uses HFS0
- Install content meta — Installs
.cnmt.ncafiles, mounts them to read CNMT metadata - Import tickets — Imports
.tikand.certfiles via the ES service - Install NCAs — Writes NCA files to content storage via NCM placeholders. NCZ files (in NSZ/XCZ) are transparently decompressed and re-encrypted on the fly
- Push application records — Registers the title with the NS service