• Stars
    star
    220
  • Rank 180,422 (Top 4 %)
  • Language
    C++
  • License
    Apache License 2.0
  • Created almost 10 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

drivelist

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

Current Release License Downloads Travis CI status AppVeyor status Dependency status

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 and 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):

const drivelist = require('drivelist');

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

Mac OS X:

[
  {
    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

[
  {
    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

[
  {
    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:

$ npm install --save drivelist

Documentation

drivelist~list()

Kind: inner method of drivelist
Summary: List available drives
Example

const drivelist = require('drivelist');

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

Tests

Run the test suite by doing:

$ 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!

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

$ npm run lint

Support

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

License

The project is licensed under the Apache 2.0 license.

More Repositories

1

rendition

A library of React UI components
TypeScript
207
star
2

etcher-sdk

TypeScript
35
star
3

balena-preload

Script for preloading containers onto balena device images
Python
34
star
4

network-manager

Rust NetworkManager bindings
Rust
33
star
5

etcher-image-write

The cross-platform way to stream an OS image to a device
JavaScript
28
star
6

dockerfile-template

Process dockerfile templates, a format that allows replacing variables in Dockerfiles.
CoffeeScript
27
star
7

node-ext2fs

NodeJS native bindings to the libext2fs for cross-platform ext{2,3,4} filesystem handling.
C
26
star
8

node-lkl

NodeJS native bindings to the Linux Kernel Library project
C
26
star
9

ngUrlBind

Easily bind AngularJS scope properties to your URL hash.
CoffeeScript
20
star
10

winusb-driver-generator

A Windows Node.js native add-on to associate USB devices to the generic WinUSB driver
C++
20
star
11

electron-modal

Easily create modals using child browser windows
JavaScript
20
star
12

elevator

Windows UAC elevation that just works
JavaScript
17
star
13

openvpn-client

CoffeeScript
17
star
14

node-tunnel

TypeScript
17
star
15

open-balena-base

Shell
15
star
16

libnm-rs

WIP: libnm Rust bindings
Rust
11
star
17

persistent-tunnel

HTTP Agent for tunneling proxies with persistent sockets
TypeScript
11
star
18

device-diagnostics

on-device diagnostics tool
Shell
10
star
19

nm-api

NetworkManager DBUS API
TypeScript
9
star
20

node-docker-delta

Calculates binary diffs between docker images to speed up pull operations when keeping history is irrelevant
TypeScript
9
star
21

validateSSHjs

A js library to validate OpenSSH public keys in the client or server. Can be used to avoid sending private keys over the wire inadvertently
JavaScript
8
star
22

resin-cli-visuals

Resin CLI UI widgets.
CoffeeScript
8
star
23

balena-image-fs

Balena image filesystem manipulation utilities.
TypeScript
8
star
24

balena-compose

Complete toolkit for building docker-compose.yml files and optionally deploy them on balenaCloud
TypeScript
8
star
25

file-disk

Handling reads / writes on disk image files.
TypeScript
7
star
26

docker-progress

TypeScript
7
star
27

resin-plugin-img

Modify a resin device image before burning it.
CoffeeScript
7
star
28

scrutinizer

Extract a git repository's metadata relying on open source conventions
TypeScript
7
star
29

umd-require-webpack-plugin

JavaScript
7
star
30

livepush

Push code to your containers - live!
TypeScript
7
star
31

resin-discoverable-services

An API to allow registration and discovery of local zeroconf services
CoffeeScript
6
star
32

partitioninfo

Get information about a partition from an image file.
TypeScript
6
star
33

diskpart

Run Windows diskpart scripts in NodeJS
CoffeeScript
6
star
34

balena-compose-parse

Parse docker-compose files into a general, usable and fully typed object
TypeScript
6
star
35

mountutils

Cross platform mount related utilities
C++
6
star
36

blockmap

Tizen's block map format
TypeScript
6
star
37

nplugm

NPM based plugin framework for NodeJS.
CoffeeScript
6
star
38

balena-procbots

Process bots used for automating the development and deployment CI pipeline
TypeScript
6
star
39

network-checker

CoffeeScript
5
star
40

analytics-client

Client part of analytics services used at balena
TypeScript
5
star
41

resin-docker-build

TypeScript
5
star
42

typed-error

TypeScript
5
star
43

resin-corvus

A wrapper around Sentry and Mixpanel that works in the browser, Node and Electron.
JavaScript
5
star
44

node-metrics-gatherer

easily gather / export prometheus metrics in NodeJS
TypeScript
5
star
45

resin-plugin-hello

Learn the basics of Resin CLI plugin development
JavaScript
5
star
46

sbvr-parser

JavaScript
4
star
47

libnss-openvpn-rs

Name Service Switch plugin for OpenVPN written in Rust
Rust
4
star
48

balena-multibuild

Build docker compositions with node!
TypeScript
4
star
49

jellyschema

JellySchema - data validation, UI form generation
Rust
4
star
50

balena-release-update

Prepare and get information about the transition between two balenaCloud application releases
TypeScript
4
star
51

audio-correction

Audio stream correction utilities.
CoffeeScript
4
star
52

node-loki-grpc-client

Loki node.js GRPC clients compiled from "logproto" schema
JavaScript
4
star
53

resin-plugin-multiburn

Burn to many SDCards at the same time.
JavaScript
4
star
54

rindle

Collection of utilities for working with Streams.
JavaScript
4
star
55

balena-deploy-request

A simple script for generating deploy requests along with release notes
JavaScript
4
star
56

balena-device-config

Get device config.json configuration.
CoffeeScript
4
star
57

balena-device-status

[DEPRECATED]Balena.io device status interpreter
CoffeeScript
4
star
58

pinejs-client-js

TypeScript
4
star
59

balena-event-log

JavaScript
4
star
60

balena-device-init

Configure and initialize devices using device specs.
CoffeeScript
4
star
61

node-balena-lint

TypeScript
4
star
62

odata-parser

JavaScript
4
star
63

balena-auth

Balena session authentication utilities
TypeScript
4
star
64

balena-settings-storage

Balena settings storage utilities.
TypeScript
4
star
65

mahler

A automated task composer and HTN based planner for building autonomous system agents.
TypeScript
4
star
66

docker-storage-gc

Automatically cleanup unused images based on various cache replacement algorithms
CoffeeScript
4
star
67

conf.js

Support per-user and per-project configuration files out of the box.
CoffeeScript
4
star
68

front-sdk

An SDK for working with Front
TypeScript
4
star
69

balena-settings-client

Balena client application shared settings.
TypeScript
4
star
70

happy-eyeballs

patches NodeJS's http(s).Agent to implement "happy eyeballs 2" (rfc8305)
TypeScript
4
star
71

bmapflash

Flash an image using a `.bmap` file
JavaScript
4
star
72

sbvr-types

TypeScript
4
star
73

resin-doodles

CLI doodles, now with more unicorns!
CoffeeScript
3
star
74

rust-cross-toolchains

Rust cross compilation toolchains as Docker images
3
star
75

blinking

TypeScript
3
star
76

resin-commit-lint

JavaScript
3
star
77

denymount

Node.js library to prevent automatic mounting of specific disks on Mac OS X.
JavaScript
3
star
78

keyfctl

Library + cli for manipulating keyframes
JavaScript
3
star
79

bluebird-lru-cache

CoffeeScript
3
star
80

requestmock

CoffeeScript
3
star
81

resin-device-operations

Execute device spec operations.
CoffeeScript
3
star
82

balena-register-device

Resin.io device registration utilities.
TypeScript
3
star
83

FT2232H-56Q-openocd

C
3
star
84

dockerignore

dockerignore is a file filter library compatible with Docker and the node-ignore API
JavaScript
3
star
85

atomic-io

A library for modifying files atomically.
Rust
3
star
86

skhema

JSON Schema utility collection
JavaScript
3
star
87

resin-cli-auth

Resin.io CLI authentication handler.
CoffeeScript
3
star
88

reql-schema

ReQL to JSON Schema translator
JavaScript
3
star
89

resin-analytics

A collection of resin analytics modules
JavaScript
3
star
90

resin-device-logs

Resin.io device logs utilities.
CoffeeScript
3
star
91

balena-image-manager

Manage device base operating systems resources with caching support.
CoffeeScript
3
star
92

etcher-image-stream

THIS MODULE IS UNMAINTAINED: Get a readable stream from any type of OS image
JavaScript
3
star
93

docker-qemu-transpose

Alter a Dockerfile to allow emulated builds without binfmt
TypeScript
3
star
94

win-drive-clean

Remove a disks partition table on Windows
C++
3
star
95

resin-device-types

CoffeeScript
2
star
96

metalsmith-dynamic

Expand metalsmith page template into multiple concrete pages
CoffeeScript
2
star
97

wary

Tiny unit test framework to test code with real files.
CoffeeScript
2
star
98

musync-backend-grooveshark

MuSync Grooveshark Backend.
CoffeeScript
2
star
99

node-beaglebone-usbboot

TypeScript
2
star
100

node-qmp

Node interface for QEMU over QMP
TypeScript
2
star