Internationalisation
Bundled Plugins API
disk
Provides provides details about disk devices attached to the system. These may be mounted, unmounted, and may include devices which do not mount, or appear in the user interface by default.
The various methods have options table parameters, which allow filtering to be performed on the operations. These tables can have any combination of the following:
  • physical - only process physical drives.
  • virtual - only process virtual drives.
  • external - only external drives.
  • internal - only internal drives.
  • ejectable - only drives that can be ejected.
  • bootable - only bootable drives.
  • writable - only writeable drives.
  • root - only top-level drives (vs partitions)
  • hidden - by default, only 'unhidden' devices are returned.
  • mounted - only mounted drives.
  • unmounted - only unmounted drives.
1
local disk = require("cp.disk")
2
local externalDrives = disk.devices({physical = true, ejectable = true})
Copied!

API Overview

API Documentation

Functions

eject

Signature
cp.disk.eject(options) -> nil
Type
Function
Description
Unmounts and ejects (where appropriate) all disks matching the provided options.
Parameters
  • options - The table of filter options.
Returns
  • Nothing.

mount

Signature
cp.disk.mount(options) -> nil
Type
Function
Description
Mounts all disks matching the provided options.
Parameters
  • options - The table of filter options.
Returns
  • Nothing.

unmount

Signature
cp.disk.unmount(options) -> nil
Type
Function
Description
Unmounts all disks matching the provided options.
Parameters
  • options - The table of filter options.
Returns
  • Nothing.

visit

Signature
cp.disk.visit(options, fn) -> nil
Type
Function
Description
Visits all drives matching the options and executes the
Parameters
  • options - The table of filter options.
  • fn - The function to execute.
Returns
  • Nothing.
Last modified 1mo ago
Export as PDF
Copy link