# 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.                                                                                                                                                                                                                                                                                                                                                           |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.oscwii.org/wii-shop-channel/js/sd-card.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
