Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/brendanashworth/diskdrive

OS compatible bindings for various CD/DVD drive utilities with NodeJS (OSX + Linux supported)
https://github.com/brendanashworth/diskdrive

Last synced: 9 days ago
JSON representation

OS compatible bindings for various CD/DVD drive utilities with NodeJS (OSX + Linux supported)

Awesome Lists containing this project

README

        

DiskDrive
=====
[![Build Status](https://travis-ci.org/brendanashworth/diskdrive.svg?branch=master)](https://travis-ci.org/brendanashworth/diskdrive)

[![DiskDrive NPM](https://nodei.co/npm/diskdrive.png)](http://npmjs.org/package/diskdrive)

> DiskDrive is a cross compatible binding for DVD and CD drives. It currently supports OSX and Linux.

## Install
```bash
$ npm install diskdrive --save
```

## CLI
```bash
$ npm install diskdrive -g
```

```bash
$ diskdrive [mount/id]
```
Mount / id is the same as the documentation's mount / id.

## Documentation
#### Eject: `function([id/mount], [callback(err)]);`
First argument can be of type `string` or `int`. It specifies the mount / ID of the disk drive to eject.

Second argument is of type `Function`, which takes an `err`. If an error occurs ejecting the disk, it will be called with a respective `Error`. It is always called upon completion (the error will be `null`).

Example usage:
```javascript
var diskdrive = require('diskdrive');

// Eject the primary disk drive.
// Note lack of callback (optional)
diskdrive.eject();

// [Mac] Eject disk of [id].
diskdrive.eject(2, function(error) {
if (error) console.log(error);
});

// [Linux] Eject disk drive, with specified mount.
diskdrive.eject('/dev/dvd', function(error) {
if (error) console.log(error);
});
diskdrive.eject('dvd'); // appended to /dev/, would result in same system file. (/dev/dvd)
```

### Cross Compatibility
Currently, OSX and Linux have been tested and are confirmed to work. The following have been tested with good results:
* OSX 10.9.2
* OSX 10.9.5
* Ubuntu 12.04

### License
[MIT](./LICENSE)