Dynamically detect when drives are being added and/or removed.
Install drivelist-scanner
by running:
$ npm install --save drivelist-scanner
- drivelist-scanner
- ~DrivelistScanner ⇐
EventEmitter
- new DrivelistScanner([options])
- instance
- static
- .getDrives() ⇒
Promise
- .getDrives() ⇒
- ~DrivelistScanner ⇐
drivelist-scanner~DrivelistScanner ⇐ EventEmitter
Kind: inner class of drivelist-scanner
Summary: Detect changes in drive list
Extends: EventEmitter
Emits: add
, remove
Access: protected
- ~DrivelistScanner ⇐
EventEmitter
- new DrivelistScanner([options])
- instance
- static
- .getDrives() ⇒
Promise
- .getDrives() ⇒
Param | Type | Default | Description |
---|---|---|---|
[options] | Object |
scan options | |
[options.interval] | Number |
1000 |
check interval |
[options.drives] | Array.<Object> |
available drives during initialization |
Example
scanner = new DrivelistScanner(interval: 1000, drives: [ { foo: 'bar' } ])
scanner.on 'add', (drives) ->
console.log drives
scanner.on 'remove', (drives) ->
console.log drives
Kind: instance method of DrivelistScanner
Summary: Stop the check interval
Throws:
- Will throw if the interval id is not valid.
Access: public
Example
scanner = new DrivelistScanner(interval: 1000, drives: [ { foo: 'bar' } ])
scanner.stop()
Fired on new drive addition.
Kind: event emitted by DrivelistScanner
Properties
Name | Type | Description |
---|---|---|
drives | Array.<Object> |
Contains the drives that have been added. |
Fired when a pre-existing drive has been removed.
Kind: event emitted by DrivelistScanner
Properties
Name | Type | Description |
---|---|---|
drives | Array.<Object> |
Contains the drives that have been removed. |
Kind: static method of DrivelistScanner
Summary: List all available drives
Fulfil: Object[]
- available drives
Example
DrivelistScanner.getDrives().then (drives) ->
console.log(drives)
If you're having any problem, please raise an issue on GitHub andand I'll be happy to help.
Run the test suite by doing:
$ gulp test
- Issue Tracker: github.com/mkorakakis/drivelist-scanner/issues
- Source Code: github.com/mkorakakis/drivelist-scanner
Before submitting a PR, please make sure that you include tests, and that coffeelint runs without any warning:
$ gulp lint
The project is licensed under the MIT license.