Giter Site home page Giter Site logo

linecode / drivelist Goto Github PK

View Code? Open in Web Editor NEW

This project forked from balena-io-modules/drivelist

0.0 2.0 0.0 678 KB

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

License: Apache License 2.0

Python 1.88% Batchfile 0.22% Shell 0.13% TypeScript 37.68% Objective-C 4.23% Objective-C++ 9.65% C++ 46.20%

drivelist's Introduction

drivelist

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

Current Release License Downloads Travis CI status AppVeyor status Dependency status Gitter Chat

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() โ‡’ Promise

Kind: inner method of drivelist
Summary: List available drives
Returns: Promise - []
Access: public
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.

drivelist's People

Contributors

balena-ci avatar brownjohnf avatar dustmason avatar fordi avatar grumpyoldman-io avatar jhermsmeier avatar joerick avatar jviotti avatar lekkas avatar lurch avatar peakwinter avatar pimterry avatar resin-io-modules-versionbot[bot] avatar robinwassen avatar superman32432432 avatar thundron avatar userabuser avatar zkochan avatar zrzka avatar zvin avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.