Socket
Socket
Sign inDemoInstall

drivelist

Package Overview
Dependencies
Maintainers
1
Versions
265
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

drivelist

List all connected drives in your computer, in all major operating systems


Version published
Weekly downloads
9.2K
decreased by-2.98%
Maintainers
1
Weekly downloads
 
Created
Source

drivelist

npm version dependencies Build Status

List all connected drives in your computer, in all major operating systems.

Notice that this module does not require admin privileges to get the drives in any operating system supported.

Supports:

  • Windows.
  • GNU/Linux distributions that include util-linux.
  • Mac OS X.

Examples (the output will vary depending on your machine):

var drivelist = require('drivelist');

drivelist.list(function(error, disks) {
		if (error) throw error;
		console.log(disks);
});


Mac OS X:

[
	{
		device: '/dev/disk0',
		description: 'GUID_partition_scheme',
		size: '*750.2 GB'
	},
	{
		device: '/dev/disk1',
		description: 'Apple_HFS Macintosh HD',
		size: '*748.9 GB'
	}
]

GNU/Linux

[
	{
		device: '/dev/sda',
		description: 'WDC WD10JPVX-75J',
		size: '931.5G',
	},
	{
		device: '/dev/sr0',
		description: 'DVD+-RW GU90N',
		size: '1024M'
	}
]

Windows

[
	{
		device: '\\\\.\\PHYSICALDRIVE0',
		description: 'WDC WD10JPVX-75JC3T0',
		size: '1000 GB'
	},
	{
		device: '\\\\.\\PHYSICALDRIVE1',
		description: 'Generic STORAGE DEVICE USB Device',
		size: '15 GB'
	}
]

Installation

Install drivelist by running:

$ npm install --save drivelist

Documentation

drivelist.list(callback)

List available drives.

The function will throw an error if you attempt to call it from an unsupported operating system.

callback(error, drives)
  • error is a possible error.
  • drives is an array of objects describing the drives found.

Tests

Run the test suite by doing:

$ gulp test

Contribute

We're looking forward to support more operating systems. Please raise an issue or even better, send a PR to increase support!

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

$ gulp lint

Support

If you're having any problem, please raise an issue on GitHub.

ChangeLog

v1.1.2

  • Prevent empty lsblk model crash the module. Return undefined description instead.

v1.1.1

  • Prevent empty wmic size crash the module. Return undefined size instead.

v1.1.0

  • Return non supported OS error to the callback instead of just throwing it.

License

The project is licensed under the MIT license.

Keywords

FAQs

Package last updated on 09 Feb 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc