# drive-tools

> Node.js package for listing drives and getting system path (Desktop, Downloads, and etc)

Latest version **0.0.24** (published 2025-06-27) · ISC license · 0 weekly downloads

## Install

```sh
npm install drive-tools
pnpm add drive-tools
yarn add drive-tools
bun add drive-tools
```

## Health

**Score 25/100 (F)** — status: maintenance-mode.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.24 |
| Published | 2025-06-27 |
| First published | 2020-06-19 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 15.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Hiroki Tanaka |
| Maintainers | luftchen |
| Keywords | drive, system, path, desktop, downloads, windows, macos |

## Links

- npm: https://www.npmjs.com/package/drive-tools
- Repository: https://github.com/Luftchen/drive-tools
- Homepage: https://github.com/Luftchen/drive-tools#readme
- Issues: https://github.com/Luftchen/drive-tools/issues
- npm.io page: https://npm.io/package/drive-tools

## Dependencies (1)

- [encoding-japanese](https://npm.io/package/encoding-japanese.md) ^1.0.30

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 0.0.24 (latest) — 2025-06-27
- 0.0.23 — 2025-06-27
- 0.0.22 — 2025-06-24
- 0.0.21 — 2025-06-23
- 0.0.20 — 2021-06-03
- 0.0.19 — 2021-05-10
- 0.0.18 — 2020-07-29
- 0.0.17 — 2020-07-12
- 0.0.16 — 2020-07-12
- 0.0.15 — 2020-07-01
- 0.0.14 — 2020-06-25
- 0.0.12 — 2020-06-24
- 0.0.11 — 2020-06-19
- 0.0.1 — 2020-06-19

## README

# drive-tools

` drive-tools` is a Node.js package for listing drives and getting system path (Desktop, Downloads, and etc).

Current version supports **MacOS** and **Windows**;

## Install

```bash
npm install drive-tools
```

## Usage

```js
const driveTools = require('drive-tools')

console.log(driveTools.systemPath("desktop"));
// Available: home, desktop, pictures, downloads, music, movies, documents

console.log(driveTools.driveList());
```

## Testing

Run the test suite:

```bash
npm test
```

For detailed output and debugging:

```bash
npm run test:sandbox
```

## driveTools.driveList
The return value is an Array, looks like:

```
[
  { name: '/', desc: 'Internal', external: false },
  { name: '/System/Volumes/Data', desc: 'Internal', external: false },
,
  { name: '/Volumes/USB-Drive', desc: 'External', external: true }
]
```

Only for Windows, It's able to specity drive type.

```
0 = Unknown
1 = No Root Directory
2 = Removable Disk
3 = Local Disk
4 = Network Drive
5 = Compact Disc
6 = RAM Disk
```

For example, if you want to list up only CD-ROM drive:

```js
console.log(driveTools.driveList(5));
```

```js
[ 
  { name: 'Name', desc: 'Description', external: false },
  { name: 'D:', desc: 'CD-ROM Disc', external: true } 
]
```

### Windows PowerShell Support
On Windows, this package now uses PowerShell by default for better compatibility and performance. If PowerShell is not available or fails, it automatically falls back to the legacy wmic method.

You can also force the use of wmic by passing `true` as the third parameter:

```js
// Force use of wmic (legacy method)
console.log(driveTools.driveList(undefined, undefined, true));
```

## Required
Please install encoding-japanese.
npm install encoding-japanese

## Repository Migration Notice
This package has been migrated to GitHub. The npm package will continue to work as before, but the source code is now available at: https://github.com/Luftchen/drive-tools

## Support
```
Zelda, inc : https://zeldainc.com/
Author : Hiroki Tanaka (@Luftchen)
X : https://x.com/hrktnk
```

## History
```
2020-06-19(0.0.1): created beta version
2020-06-19(0.0.11): bug fix
2020-06-24(0.0.12): added driveTools.systemPath("home")
2020-06-25(0.0.14): bug fix
2020-07-01(0.0.15): bug fix
2020-07-12(0.0.16): added drive type paramater for driveList() (only for windows)
2020-07-12(0.0.17): bug fix
2020-07-29(0.0.18): added MediaType only for Mac
2021-05-10(0.0.19): bug fix
2021-06-03(0.0.20): bug fix
2025-06-24(0.0.21): migrated repository to GitHub, added proper package.json metadata
2025-06-24(0.0.22): added PowerShell support for Windows with wmic fallback, added use_wmic flag
2025-06-27(0.0.23, 0.0.24): bug fix
```

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