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(path): Application

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

Parameters

ParameterTypeDescription
pathstring | URLThe path of the .nro file.

Returns

Application

Example

const app = new Switch.Application('sdmc:/hbmenu.nro');
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

app.createProfileSaveDataSync(Switch.Profile.current);

createSaveDataSync()

createSaveDataSync(info): SaveData

Parameters

Returns

SaveData


filterSaveData()

filterSaveData(fn?): IteratorObject<SaveData, undefined, unknown>

Parameters

ParameterType
fn?(saveData) => boolean

Returns

IteratorObject<SaveData, undefined, unknown>


findSaveData()

findSaveData(fn?): undefined | SaveData

Parameters

ParameterType
fn?(saveData) => boolean

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