Namespaces
Switch
The Switch global object contains native interfaces to interact with the Switch hardware.
Index
Classes
| Class | Description | 
|---|---|
| Album | The Switch.Albumclass allows for interacting with the Switch's photo gallery, providing access to the screenshots / video recordings that the user has saved. | 
| AlbumFile | Represents a file within a Switch.Albumcontent store, which is either a screenshot (JPEG image) or a screen recording (MP4 movie). | 
| Application | Represents an installed application (game) on the console, or a homebrew application ( .nrofile). | 
| Env | A Map-like object providing methods to interact with the environment variables of the process. | 
| FileSystem | - | 
| FsFile | The Switch.FsFileclass is a special implementation of the globalFileclass, which interacts with the system's physical file system. | 
| IRSensor | The IRSensorclass reads the controller's IR (infrared) camera, allowing the application to get the image data for each frame of the camera. | 
| Profile | Represents a user profile that exists on the system. | 
| SaveData | Represents a "save data store". | 
| Server | EventTarget is a DOM interface implemented by objects that can receive events and may have listeners for them. | 
| Service | - | 
| Socket | The Socketclass represents a TCP connection, from which you can read and write data. A socket begins in a connected state (if the socket fails to connect, an error is thrown). While in a connected state, the socket’sReadableStreamandWritableStreamcan be read from and written to respectively. | 
| SocketEvent | - | 
Interfaces
| Interface | Description | 
|---|---|
| FsFileOptions | Options object for the Switch.file()function. | 
| FsFileStreamOptions | Options object for the Switch.FsFile#stream()function. | 
| InspectOptions | - | 
| IRSensorInit | - | 
| ListenOptions | Specifies the port number and optional IP address for creating a TCP server. | 
| NetworkInfo | - | 
| SaveDataCreationInfoBase | - | 
| SaveDataCreationInfoWithNacp | - | 
| ServiceDispatchParams | - | 
| SocketAddress | Specifies the port number and optional hostname for connecting to a remove server over the network. | 
| SocketEventInit | - | 
| SocketInfo | - | 
| SocketOptions | - | 
| Stats | - | 
| Versions | - | 
| Vibration | - | 
Type Aliases
| Type alias | Description | 
|---|---|
| PathLike | - | 
| ProfileUid | - | 
| SaveDataCreationInfo | - | 
| SecureTransportKind | - | 
Variables
| Variable | Description | 
|---|---|
| argv | Array of the arguments passed to the process. Under normal circumstances, this array contains a single entry with the absolute path to the .nrofile. | 
| entrypoint | String value of the entrypoint JavaScript file that was evaluated. If a main.jsfile is present on the application's RomFS, then that will be executed first, in which case the value will beromfs:/main.js. Otherwise, the value will be the path of the.nrofile on the SD card, with the.nroextension replaced with.js. | 
| env | A Map-like object providing methods to interact with the environment variables of the process. | 
| version | An Object containing the versions numbers of nx.js and all supporting C libraries. | 
Functions
| Function | Description | 
|---|---|
| appletType | Returns the "applet type" of the running application. | 
| chdir | Changes the current working directory to the specified path. | 
| connect | Creates a TCP connection to the specified address. | 
| cwd | Returns the current working directory as a URL string with a trailing slash. | 
| exit | Signals for the nx.js application to exit. The global "unload" event will be invoked after the event loop has stopped. | 
| file | Returns a Switch.FsFileinstance for the givenpath. | 
| inspect | - | 
| listen | Creates a TCP server bound to the specified portnumber. | 
| mkdirSync | Creates the directory at the provided path, as well as any necessary parent directories. | 
| networkInfo | - | 
| operationMode | Returns the current "operation mode" of the device. | 
| readDirSync | Synchronously returns an array of the file names within path. | 
| readFile | Returns a Promise which resolves to an ArrayBuffercontaining the contents of the file atpath. | 
| readFileSync | Synchronously returns an ArrayBuffercontaining the contents of the file atpath. | 
| remove | Removes the file or directory recursively specified by path. | 
| removeSync | Synchronously removes the file or directory recursively specified by path. | 
| rename | Renames a file or directory. | 
| renameSync | Synchronously renames a file or directory. | 
| resolveDns | Performs a DNS lookup to resolve a hostname to an array of IP addresses. | 
| setMediaPlaybackState | Set media playback state. | 
| stat | Returns a Promise which resolves to an object containing information about the file pointed to by path. | 
| statSync | - | 
| writeFileSync | Synchronously writes the contents of datato the file atpath. |