Drives
The Drives module lets you find external storage locations (drives). You can use these drives with the MediaBrowser and Recording modules.
Notice: We currently only support USB drives, but plan to also support UPNP drives in the future.
Call getDrives to get a list of all available Drive objects.
You will recieve an onDrivesChanged signal when the available drives change.
It is possible to re-format a USB drive using the formatDrive function.
Members
DriveType
Enum for the drive type.
Properties:
| Name | Type | Description |
|---|---|---|
| USB | USB drive. | |
| UPNP | UPNP drive. |
FileSystem
Enum for the drive file system.
Properties:
| Name | Type | Description |
|---|---|---|
| FAT | FAT32 file system. | |
| NTFS | NTFS file system. | |
| EXT2 | ext2 file system. | |
| EXFAT | exfat file system. |
onDrivesChanged
Signal fired when the number of available Drives has changed. This usually happens when a USB stick is connected/disconnected. The listener will be passed the following arguments:
- drives: An Array of Drive objects. This is exactly the same as the result of getDrives.
Methods
formatDrive(mrl, filesystem, label)
Formats a drive to a new file system. This erases all files on the drive.
Parameters:
| Name | Type | Description |
|---|---|---|
mrl | The MRL of the drive to be formatted. | |
filesystem | The desired FileSystem for the drive. | |
label | Add optionally a label for the drive to be formatted. |
Returns:
| Type | Description |
|---|---|
| A promise. | No arguments are passed to the completion handler. |
getDrives()
Get a list of all Drives.
Returns:
| Type | Description |
|---|---|
| A promise. | The completion handler will be passed the following arguments: - drives: An Array of Drive objects, populated as per the template. |
Type Definitions
Drive
A description for a drive
Known bug: The format field duplicates the name field.
Properties:
| Name | Type | Description |
|---|---|---|
| mrl | MRL | The Drive's MRL. |
| name | String | The Drive's name. |
| type | DriveType | The Drive's DriveType. |
| format | FileSystem | The Drive's FileSystem. |
| size | Number | The Drive's size in bytes. |
| free | Number | The Drive's free space in bytes. |
| used | Number | The Drive's used space in bytes. |
| isMounted | Boolean | true if the drive is mounted, false otherwise. |
| isWritable | Boolean | true if the drive is writable, false otherwise. |
| uuid | String | The Drive's UUID. |