nx.js
NamespacesSwitchClasses

Application

Represents an installed application (game) on the console, or a homebrew application (.nro file).

Can be used as an iterator to retrieve the list of installed applications.

Example

for (const app of Switch.Application) {
  console.log(app.name);
}

Constructors

new Application()

new Application(id): Application

Creates an Application instance from the ID of an installed application.

Parameters

ParameterTypeDescription
idbigintThe ID of the installed application.

Returns

Application

Example

const app = new Switch.Application(0x100bc0018138000n);
console.log(app.name);

new Application()

new Application(nro): Application

Creates an Application instance from an ArrayBuffer containing the contents of a .nro homebrew application.

Parameters

ParameterTypeDescription
nroArrayBufferThe contents of the .nro file.

Returns

Application

Example

const nro = await Switch.readFile('sdmc:/hbmenu.nro');
const app = new Switch.Application(nro);
console.log(app.name);

Properties

PropertyModifierTypeDescription
authorreadonlystringThe author or publisher of the application.
icon?readonlyArrayBufferThe raw JPEG data for the cover art of the application. Can be decoded with the Image class.
idreadonlybigintThe 64-bit unique identifier of the application (PresenceGroupId).
nacpreadonlyArrayBufferThe raw NACP data of the application. Use the @tootallnate/nacp module to parse this data.
namereadonlystringThe name of the application.
versionreadonlystringThe version of the application.

Accessors

self

get static self(): Application

An Application instance representing the currently running application.

Returns

Application

Methods

createCacheSaveDataSync()

createCacheSaveDataSync(index, info?): SaveData

Creates the Cache storage for this Application for the specified save index ID.

Parameters

ParameterTypeDefault valueDescription
indexnumber0The save index ID. Defaults to 0.
info?Partial<SaveDataCreationInfoWithNacp>undefined-

Returns

SaveData


createProfileSaveDataSync()

createProfileSaveDataSync(profile, info?): SaveData

Creates the Save Data for this Application for the provided user profile.

Parameters

ParameterTypeDescription
profileProfileThe Profile to create the save data for.
info?Partial<SaveDataCreationInfoWithNacp>-

Returns

SaveData

Example

const profile = Switch.currentProfile({ required: true });
app.createSaveData(profile);

createSaveDataSync()

createSaveDataSync(info): SaveData

Parameters

Returns

SaveData


filterSaveData()

filterSaveData(filter?): Generator<SaveData, void, unknown>

Parameters

ParameterType
filter?Omit<SaveDataFilter, "applicationId">

Returns

Generator<SaveData, void, unknown>


findSaveData()

findSaveData(filter): undefined | SaveData

Parameters

ParameterType
filterOmit<SaveDataFilter, "applicationId">

Returns

undefined | SaveData


launch()

launch(): never

Launches the application.

Returns

never

Note

This only works for installed applications (not homebrew apps).


[iterator]()

static [iterator](): Generator<Application, void, unknown>

Returns

Generator<Application, void, unknown>

On this page