CBFS Storage 2020 Node.js Edition

Questions / Feedback?

MountMedia Method

Mounts media in the virtual drive, making it accessible for reading and writing.

Syntax

cbdisk.mountMedia(timeout, [callback])

Callback

The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).

The callback for this method is defined as:

function(err){ }

'err' is the error that occurred. If there was no error, then 'err' is 'null'.

'err' has 2 properties which hold detailed information:

err.code
err.message

Remarks

After using CreateStorage to create a virtual drive, applications should call this method to "insert storage media" into it. For plug-and-play virtual drives with non-removable media (see StorageType), this method must be called before AddMountingPoint is called. For all other virtual drives, AddMountingPoint can be called before or after calling this method.

Timeout specifies how many milliseconds the driver will wait for events to execute before cancelling the underlying OS requests; please refer to the Timeouts topic for more information. Valid values are 0, which disables event timeouts, and values greater than or equal to 3000. (Passing a non-zero value less than 3000 will cause this method to fail with an ERROR_IMPLEMENTATION_LIMIT (1292, 0x50C) error code.)

When event timeouts are in effect, event handlers can call ResetTimeout to reset the timer if they require additional time to complete an operation.

Note that there are a number of properties that cannot be changed once media is mounted. Such restrictions are noted in properties' documentation as applicable.

If this method encounters any issues during its execution, it , and additional information is logged to the Windows system log as described in the Error Reporting and Handling topic.

Note: This method can only be called after creating a virtual drive, and cannot be called within events.

Virtual Drives and Mounting Points

CBDrive and CBMemDrive components: When applications call the OpenVault (CBDrive) or CreateVault method, the specified vault is opened and used to create and mount a virtual drive. This virtual drive is created without a drive letter.

To add a drive letter for the virtual drive, applications have to call the AddMountingPoint method. Once a drive letter is assigned, the virtual drive will be visible to the system and other applications, allowing them to start accessing its files and directories.

CBDisk component:

When applications call the CreateStorage method, a virtual drive is created. Virtual drives are created without any "media" in them (like a CD drive without a CD inserted), and without any mounting points (drive letters, UNC paths, etc.).

After creating a virtual drive, applications should call MountMedia to "insert" virtual storage media into the virtual drive. This call will cause the class's events to start firing; applications must handle these events correctly, or the MountMedia call will fail.

Once media has been mounted in the virtual drive, applications should use the AddMountingPoint method to add one or more mounting points for the virtual drive. These mounting points make the virtual drive, visible to the system and other applications, allowing them to start accessing the contents of the CBDisk-based virtual filesystem.

Note that applications can technically call AddMountingPoint before MountMedia (except for plug-and-play virtual drives with non-removable media; see StorageType), but any attempts to access a virtual drive with no media mounted will result in a "no media" error.

Copyright (c) 2021 Callback Technologies, Inc. - All rights reserved.
CBFS Storage 2020 Node.js Edition - Version 20.0 [Build 7986]