> For the complete documentation index, see [llms.txt](https://docs.oscwii.org/wii-shop-channel/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.oscwii.org/wii-shop-channel/js/sd-card.md).

# SD Card

For all SD card queries, you utilize the `wiiSDCard` object. You use it to query statistics and informaton about the card, and call on it to perform title-related operations.

```javascript
var sdCard = new wiiSDCard();
```

## Members

| Member Name                               | Discussion                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ----------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `sdCard.checkValidSD(titleId, titleSize)` | <p>Checks whether an SD card is inserted, and whether it is available to be mounted as FAT, similar to <code>isInserted()</code>.</p><p></p><p>Past this, it checks whether the given <code>titleId</code> with the given <code>titleSize</code> is available to be migrated to the SD, depending on a myriad of checks.</p><p></p><p>Returns a negative number if not successful, zero if possible.</p><p></p><p>TODO: Document what error codes in particular.</p> |
| `sdCard.isInserted()`                     | <p>Checks whether an SD card is inserted, and whether it is available to be mounted as FAT.</p><p></p><p>Returns <code>true</code> or <code>false</code>, depending on its state.</p>                                                                                                                                                                                                                                                                                |
| `sdCard.isJournaling()`                   | Checks with the internal SD card manager on whether a journaling task is ongoing.                                                                                                                                                                                                                                                                                                                                                                                    |
| `sdCard.getFreeKBytes()`                  | Returns the number of kilobytes free on the inserted SD card.                                                                                                                                                                                                                                                                                                                                                                                                        |
| `sdCard.getSDBackupSize()`                | Returns the size of the pending SD card backup operation.                                                                                                                                                                                                                                                                                                                                                                                                            |
| `sdCard.setJournalFlag(titleId)`          | Marks the given `titleId` for downloading directly to the inserted SD card.                                                                                                                                                                                                                                                                                                                                                                                          |
| `sdCard.backupToSDCard(titleId)`          | Starts the backup (transfer?) of a title's data to the SD card.                                                                                                                                                                                                                                                                                                                                                                                                      |
| `sdCard.stopBackupToSDCard()`             | Halts the ongoing backup to the SD card. Does not clear copied data.                                                                                                                                                                                                                                                                                                                                                                                                 |
| `sdCard.setCancelJournal()`               | Cancels the ongoing journal operation.                                                                                                                                                                                                                                                                                                                                                                                                                               |
| `sdCard.hasProgressFinished()`            | Returns `true` or `false` on whether a previously registered journaling or backup operation has completed.                                                                                                                                                                                                                                                                                                                                                           |
