drivelist-scanner

1.0.0 • Public • Published

drivelist-scanner

npm version dependencies Build Status Build status

Dynamically detect when drives are being added and/or removed.

Installation

Install drivelist-scanner by running:

$ npm install --save drivelist-scanner

Documentation

drivelist-scanner~DrivelistScanner ⇐ EventEmitter

Kind: inner class of drivelist-scanner
Summary: Detect changes in drive list
Extends: EventEmitter
Emits: add, remove
Access: protected

new DrivelistScanner([options])

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

drivelistScanner.stop()

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()

"add"

Fired on new drive addition.

Kind: event emitted by DrivelistScanner
Properties

Name Type Description
drives Array.<Object> Contains the drives that have been added.

"remove"

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.

DrivelistScanner.getDrives() ⇒ Promise

Kind: static method of DrivelistScanner
Summary: List all available drives
Fulfil: Object[] - available drives
Example

DrivelistScanner.getDrives().then (drives) ->
    console.log(drives)

Support

If you're having any problem, please raise an issue on GitHub andand I'll be happy to help.

Tests

Run the test suite by doing:

$ gulp test

Contribute

Before submitting a PR, please make sure that you include tests, and that coffeelint runs without any warning:

$ gulp lint

License

The project is licensed under the MIT license.

Package Sidebar

Install

npm i drivelist-scanner

Weekly Downloads

2

Version

1.0.0

License

MIT

Last publish

Collaborators

  • mkorakakis