# drivelist

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

Latest version **12.0.2** (published 2024-04-08) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install drivelist
pnpm add drivelist
yarn add drivelist
bun add drivelist
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 12.0.2 |
| Published | 2024-04-08 |
| First published | 2015-01-30 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=18 |
| Dependencies | 4 |
| Unpacked size | 126.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 267 |
| Author | Juan Cruz Viotti |
| Maintainers | balena.io |
| Keywords | disk, cross, platform, physical, drive, list |

## Links

- npm: https://www.npmjs.com/package/drivelist
- Repository: https://github.com/balena-io-modules/drivelist
- Issues: https://github.com/balena-io-modules/drivelist/issues
- npm.io page: https://npm.io/package/drivelist

## Dependencies (4)

- [debug](https://npm.io/package/debug.md) ^4.3.4
- [bindings](https://npm.io/package/bindings.md) ^1.5.0
- [node-addon-api](https://npm.io/package/node-addon-api.md) ^8.0.0
- [prebuild-install](https://npm.io/package/prebuild-install.md) ^7.1.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 12.0.2 (latest) — 2024-04-08
- 12.0.3-build-renovate-actions-setup-node-4-x-3f158fca98eb5062a4a090c59cd997ffb3778d0b-1 (build-renovate-actions-setup-node-4-x-3f158fca98eb5062a4a090c59cd997ffb3778d0b) — 2024-04-08
- 12.0.3-build-renovate-major--balenalint-272d13705811675c22066ab9275004dfc5f47e88-1 (build-renovate-major--balenalint) — 2024-04-08
- 12.0.2-build-renovate-major--balenalint-9798eece8c1491c1e49ad4839a70db29d17bdb5f-1 (build-renovate-major--balenalint-9798eece8c1491c1e49ad4839a70db29d17bdb5f) — 2024-04-08
- 12.0.2-build-renovate-actions-setup-python-digest-8d277f7e43295d5b6b55ce7893c5f3ebc103cc9a-1 (build-renovate-actions-setup-python-digest-8d277f7e43295d5b6b55ce7893c5f3ebc103cc9a) — 2024-04-08
- 12.0.1-build-renovate-pin-dependencies-296474af7d34af109becadde0c1c3f9d9e9db475-1 (build-renovate-pin-dependencies-296474af7d34af109becadde0c1c3f9d9e9db475) — 2024-04-08
- 12.0.1-build-renovate-major--balenalint-157ade42859104a659c3d1b4702e3059dea7c4d4-1 (build-renovate-major--balenalint-157ade42859104a659c3d1b4702e3059dea7c4d4) — 2024-04-08
- 12.0.0-build-renovate-major-node-addon-api-d02c8e3006f9c4ec4763cac8cff553b3634080f7-1 (build-renovate-major-node-addon-api) — 2024-04-08
- 11.2.3-build-renovate-major--balenalint-8edd5465a12e8944bd015181c9d79cb7188a7565-1 (build-renovate-major--balenalint-8edd5465a12e8944bd015181c9d79cb7188a7565) — 2024-03-16
- 11.2.3-build-renovate-major-node-addon-api-09c0a5332763d65bb73a6d40de4118454ab8cf66-1 (build-renovate-major-node-addon-api-09c0a5332763d65bb73a6d40de4118454ab8cf66) — 2024-03-08
- 11.2.2-build-bump-node-gyp-147394c5b59fdc4a720eb65604debd6619e50216-1 (build-bump-node-gyp-147394c5b59fdc4a720eb65604debd6619e50216) — 2024-03-08
- 11.2.2-build-renovate-major--balenalint-b5fb49d6af547894c394e744074ff433f4c181e4-1 (build-renovate-major--balenalint-b5fb49d6af547894c394e744074ff433f4c181e4) — 2024-02-15
- 11.2.2-build-renovate-major-node-addon-api-b056b06c78819c33df1db137ed38096fb7abcd18-1 (build-renovate-major-node-addon-api-b056b06c78819c33df1db137ed38096fb7abcd18) — 2024-02-15
- 11.2.1-build-kyle-custom-runs-on-961183e410973cee6824c665ad9239cd1bb49703-1 (build-kyle-custom-runs-on-961183e410973cee6824c665ad9239cd1bb49703) — 2024-02-14
- 11.2.1-build-renovate-major--balenalint-0e0411f6caaa3392c05dac800aa71d25ab59580c-1 (build-renovate-major--balenalint-0e0411f6caaa3392c05dac800aa71d25ab59580c) — 2024-01-18
- … 250 more at https://npm.io/package/drivelist/versions

## README

<!-- Make sure you edit doc/README.hbs rather than README.md because the latter is auto-generated -->

drivelist
=========

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

[![Current Release](https://img.shields.io/npm/v/drivelist.svg?style=flat-square)](https://npmjs.com/package/drivelist)
[![License](https://img.shields.io/npm/l/drivelist.svg?style=flat-square)](https://npmjs.com/package/drivelist)
[![Downloads](https://img.shields.io/npm/dm/drivelist.svg?style=flat-square)](https://npmjs.com/package/drivelist)
[![Travis CI status](https://img.shields.io/travis/balena-io-modules/drivelist/master.svg?style=flat-square&label=linux)](https://travis-ci.org/balena-io-modules/drivelist/branches)
[![AppVeyor status](https://img.shields.io/appveyor/ci/balena-io/drivelist/master.svg?style=flat-square&label=windows)](https://ci.appveyor.com/project/balena-io/drivelist/branch/master)
[![Dependency status](https://img.shields.io/david/balena-io-modules/drivelist.svg?style=flat-square)](https://david-dm.org/balena-io-modules/drivelist)

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

Supports:

- Windows.
- GNU/Linux distributions that include [util-linux](https://github.com/karelzak/util-linux) and [udev](https://wiki.archlinux.org/index.php/udev).
- Mac OS X.

When the user executes `drivelist.list()`, the module checks the operating
system of the client and executes the corresponding drive scanning script.

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

```js
const drivelist = require('drivelist');

const drives = await drivelist.list();
console.log(drives);
```

***

Mac OS X:

```sh
[
  {
    device: '/dev/disk0',
    displayName: '/dev/disk0',
    description: 'GUID_partition_scheme',
    size: 68719476736,
    mountpoints: [
      {
        path: '/'
      }
    ],
    raw: '/dev/rdisk0',
    protected: false,
    system: true
  },
  {
    device: '/dev/disk1',
    displayName: '/dev/disk1',
    description: 'Apple_HFS Macintosh HD',
    size: 68719476736,
    mountpoints: [],
    raw: '/dev/rdisk0',
    protected: false,
    system: true
  }
]
```

***

GNU/Linux

```sh
[
  {
    device: '/dev/sda',
    displayName: '/dev/sda',
    description: 'WDC WD10JPVX-75J',
    size: 68719476736,
    mountpoints: [
      {
        path: '/'
      }
    ],
    raw: '/dev/sda',
    protected: false,
    system: true
  },
  {
    device: '/dev/sdb',
    displayName: '/dev/sdb',
    description: 'DataTraveler 2.0',
    size: 7823458304,
    mountpoints: [
      {
        path: '/media/UNTITLED'
      }
    ],
    raw: '/dev/sdb',
    protected: true,
    system: false
  }
]
```

***

Windows

```sh
[
  {
    device: '\\\\.\\PHYSICALDRIVE0',
    displayName: 'C:',
    description: 'WDC WD10JPVX-75JC3T0',
    size: 68719476736,
    mountpoints: [
      {
        path: 'C:'
      }
    ],
    raw: '\\\\.\\PHYSICALDRIVE0',
    protected: false,
    system: true
  },
  {
    device: '\\\\.\\PHYSICALDRIVE1',
    displayName: 'D:, F:',
    description: 'Generic STORAGE DEVICE USB Device',
    size: 7823458304,
    mountpoints: [
      {
        path: 'D:'
      },
      {
        path: 'F:'
      }
    ],
    raw: '\\\\.\\PHYSICALDRIVE1',
    protected: true,
    system: false
  },
  {
    device: '\\\\.\\PHYSICALDRIVE2',
    displayName: '\\\\.\\PHYSICALDRIVE2',
    description: 'Silicon-Power2G',
    size: 2014314496,
    mountpoints: [],
    raw: '\\\\.\\PHYSICALDRIVE2',
    protected: false,
    system: false
  }
]
```

Installation
------------

Install `drivelist` by running:

```sh
$ npm install --save drivelist
```

Documentation
-------------

<a name="module_drivelist..list"></a>

### drivelist~list()
**Kind**: inner method of [<code>drivelist</code>](#module_drivelist)  
**Summary**: List available drives  
**Example**  
```js
const drivelist = require('drivelist');

const drives = await drivelist.list();
drives.forEach((drive) => {
  console.log(drive);
});
```

Tests
-----

Run the test suite by doing:

```sh
$ npm test
```

Contribute
----------

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

- Issue Tracker: [github.com/balena-io-modules/drivelist/issues](https://github.com/balena-io-modules/drivelist/issues)
- Source Code: [github.com/balena-io-modules/drivelist](https://github.com/balena-io-modules/drivelist)

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

```sh
$ npm run lint
```

Support
-------

If you're having any problem, please [raise an issue](https://github.com/balena-io-modules/drivelist/issues/new) on GitHub.

License
-------

The project is licensed under the Apache 2.0 license.

[yaml]: http://yaml.org

---
_Source: https://npm.io/package/drivelist · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
