{"_id":"zkochan-drivelist","_rev":"2-6e7ef5fed858dbf73817d642553ac566","name":"zkochan-drivelist","description":"List all connected drives in your computer, in all major operating systems","dist-tags":{"latest":"0.0.0"},"versions":{"0.0.0":{"name":"zkochan-drivelist","version":"0.0.0","description":"List all connected drives in your computer, in all major operating systems","main":"lib/drivelist.js","homepage":"https://github.com/resin-io-modules/drivelist","gypfile":true,"repository":{"type":"git","url":"git://github.com/resin-io-modules/drivelist.git"},"keywords":["disk","cross","platform","physical","drive","list"],"directories":{"test":"tests"},"scripts":{"test":"npm run lint && mocha --recursive tests -R spec","compile-scripts":"node scripts/compile.js","lint":"eslint lib tests example && cpplint --recursive src","readme":"jsdoc2md --template doc/README.hbs lib/drivelist.js > README.md","configure":"node-gyp configure","build":"node-gyp build","rebuild":"node-gyp rebuild","install":"prebuild-install || node-gyp rebuild","prebuild":"prebuild --all --strip"},"bin":{"drivelist-darwin":"scripts/darwin.sh","drivelist-linux":"scripts/linux.sh"},"author":{"name":"Juan Cruz Viotti","email":"juan@resin.io"},"license":"Apache-2.0","engines":{"node":">=4"},"devDependencies":{"eslint":"^4.7.2","jsdoc-to-markdown":"^3.0.0","mocha":"^3.5.3","mochainon":"^2.0.0","prebuild":"^6.2.1"},"dependencies":{"bindings":"^1.3.0","debug":"^3.1.0","js-yaml":"^3.10.0","lodash":"^4.16.4","nan":"^2.7.0","prebuild-install":"^2.2.2"},"gitHead":"0d436885267d6221cbef342d3f7eb654416fd845","bugs":{"url":"https://github.com/resin-io-modules/drivelist/issues"},"_id":"zkochan-drivelist@0.0.0","_npmVersion":"5.4.2","_nodeVersion":"6.4.0","_npmUser":{"name":"zkochan","email":"zoltan.kochan@gmail.com"},"dist":{"integrity":"sha512-bx/VIFk9YjCUvONHmBzpoBYaX7ze6B/YNG5BTD8zpe5JVonubpMSB4+GQZ/DZL2ZsOEpT0ILzJk2z2nbtRHBZQ==","shasum":"873a1a5c04edaa898215cea85c2c1cbc60049695","tarball":"https://registry.npmjs.org/zkochan-drivelist/-/zkochan-drivelist-0.0.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEXSwi9w7SEf/kV7LC50LrgDR/dPay90jl/SI3Brw1NFAiEAgRNf81wGDq/7RK1FPt4xuu2yIQjIZ8UW3zsRzUWIzP8="}]},"maintainers":[{"name":"zkochan","email":"zoltan.kochan@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/zkochan-drivelist-0.0.0.tgz_1506776555272_0.7171421814709902"},"deprecated":"Use drivelist>=5.2.3"}},"readme":"<!-- Make sure you edit doc/README.hbs rather than README.md because the latter is auto-generated -->\n\ndrivelist\n=========\n\n> List all connected drives in your computer, in all major operating systems.\n\n[![Current Release](https://img.shields.io/npm/v/drivelist.svg?style=flat-square)](https://npmjs.com/package/drivelist)\n[![License](https://img.shields.io/npm/l/drivelist.svg?style=flat-square)](https://npmjs.com/package/drivelist)\n[![Downloads](https://img.shields.io/npm/dm/drivelist.svg?style=flat-square)](https://npmjs.com/package/drivelist)\n[![Travis CI status](https://img.shields.io/travis/resin-io-modules/drivelist/master.svg?style=flat-square&label=linux)](https://travis-ci.org/resin-io-modules/drivelist/branches)\n[![AppVeyor status](https://img.shields.io/appveyor/ci/resin-io/drivelist/master.svg?style=flat-square&label=windows)](https://ci.appveyor.com/project/resin-io/drivelist/branch/master)\n[![Dependency status](https://img.shields.io/david/resin-io-modules/drivelist.svg?style=flat-square)](https://david-dm.org/resin-io-modules/drivelist)\n[![Gitter Chat](https://img.shields.io/gitter/room/resin-io/etcher.svg?style=flat-square)](https://gitter.im/resin-io/etcher)\n\nNotice that this module **does not require** admin privileges to get the drives in any supported operating system.\n\nSupports:\n\n- Windows.\n- GNU/Linux distributions that include [util-linux](https://github.com/karelzak/util-linux) and [udev](https://wiki.archlinux.org/index.php/udev).\n- Mac OS X.\n\nThe `drivelist` core consists of a set of scripts built with technologies that\nare available by default on the target operating systems (like Bash, VBScript,\netc). Each of these scripts attempts to get information about the available\ndrives (and metadata related to them), using any methods the target platform\nprovides, like a combination of `diskutil`, `/proc/mounts`, etc. You can find\nthese scripts in the `scripts/` directory.\n\nThe scripts are then expected to print to `stdout` all the drive information\nthey have gathered in a predefined way, based on the [YAML][yaml] language. The\nscripts are expected to output a set of blocks (separated by blank lines), each\nrepresenting a drive with a set of key/value pairs. The exact keys that we\nexpect are constantly changing while we keep improving this module, but you can\nsee what the currently expected keys are by running the platform script that\ncorresponds to your operating system.\n\nThis is how the raw output looks on my MacBook Pro at the time of this writing:\n\n```sh\n$ ./scripts/darwin.sh\ndevice: /dev/disk0\ndisplayName: /dev/disk0\ndescription: \"APPLE SSD SM0256G\"\nsize: 251000193024\nmountpoints: []\nraw: /dev/rdisk0\nprotected: False\nsystem: True\n\ndevice: /dev/disk1\ndisplayName: /dev/disk1\ndescription: \"Macintosh HD\"\nsize: 249779191808\nmountpoints:\n  - path: /\nraw: /dev/rdisk1\nprotected: False\nsystem: True\n```\n\nBecause of the simplicity of this module's design, supporting a new operating\nsystem simply means adding a new script to `scripts/` that gathers drive data\nand outputs something similar to the above example. The challenge with this is\nthat we must ensure all the platform scripts print consistent output.\n\nWhen the user executes `drivelist.list()`, the module checks the operating\nsystem of the client, and executes the corresponding drive scanning script as a\nchild process. It then parses the [YAML][yaml] output of the script as an array\nof objects, and returns that to the user.\n\nExamples (the output will vary depending on your machine):\n\n```js\nconst drivelist = require('drivelist');\n\ndrivelist.list((error, drives) => {\n  if (error) {\n    throw error;\n  }\n\n  console.log(drives);\n});\n```\n\n***\n\nMac OS X:\n\n```sh\n[\n  {\n    device: '/dev/disk0',\n    displayName: '/dev/disk0',\n    description: 'GUID_partition_scheme',\n    size: 68719476736,\n    mountpoints: [\n      {\n        path: '/'\n      }\n    ],\n    raw: '/dev/rdisk0',\n    protected: false,\n    system: true\n  },\n  {\n    device: '/dev/disk1',\n    displayName: '/dev/disk1',\n    description: 'Apple_HFS Macintosh HD',\n    size: 68719476736,\n    mountpoints: [],\n    raw: '/dev/rdisk0',\n    protected: false,\n    system: true\n  }\n]\n```\n\n***\n\nGNU/Linux\n\n```sh\n[\n  {\n    device: '/dev/sda',\n    displayName: '/dev/sda',\n    description: 'WDC WD10JPVX-75J',\n    size: 68719476736,\n    mountpoints: [\n      {\n        path: '/'\n      }\n    ],\n    raw: '/dev/sda',\n    protected: false,\n    system: true\n  },\n  {\n    device: '/dev/sdb',\n    displayName: '/dev/sdb',\n    description: 'DataTraveler 2.0',\n    size: 7823458304,\n    mountpoints: [\n      {\n        path: '/media/UNTITLED'\n      }\n    ],\n    raw: '/dev/sdb',\n    protected: true,\n    system: false\n  }\n]\n```\n\n***\n\nWindows\n\n```sh\n[\n  {\n    device: '\\\\\\\\.\\\\PHYSICALDRIVE0',\n    displayName: 'C:',\n    description: 'WDC WD10JPVX-75JC3T0',\n    size: 68719476736,\n    mountpoints: [\n      {\n        path: 'C:'\n      }\n    ],\n    raw: '\\\\\\\\.\\\\PHYSICALDRIVE0',\n    protected: false,\n    system: true\n  },\n  {\n    device: '\\\\\\\\.\\\\PHYSICALDRIVE1',\n    displayName: 'D:, F:',\n    description: 'Generic STORAGE DEVICE USB Device',\n    size: 7823458304,\n    mountpoints: [\n      {\n        path: 'D:'\n      },\n      {\n        path: 'F:'\n      }\n    ],\n    raw: '\\\\\\\\.\\\\PHYSICALDRIVE1',\n    protected: true,\n    system: false\n  },\n  {\n    device: '\\\\\\\\.\\\\PHYSICALDRIVE2',\n    displayName: '\\\\\\\\.\\\\PHYSICALDRIVE2',\n    description: 'Silicon-Power2G',\n    size: 2014314496,\n    mountpoints: [],\n    raw: '\\\\\\\\.\\\\PHYSICALDRIVE2',\n    protected: false,\n    system: false\n  }\n]\n```\n\nInstallation\n------------\n\nInstall `drivelist` by running:\n\n```sh\n$ npm install --save drivelist\n```\n\nDocumentation\n-------------\n\n<a name=\"module_drivelist.list\"></a>\n\n### drivelist.list(callback)\n**Kind**: static method of [<code>drivelist</code>](#module_drivelist)  \n**Summary**: List available drives  \n**Access**: public  \n\n| Param | Type | Description |\n| --- | --- | --- |\n| callback | <code>function</code> | callback (error, drives) |\n\n**Example**  \n```js\nconst drivelist = require('drivelist');\n\ndrivelist.list((error, drives) => {\n  if (error) {\n    throw error;\n  }\n\n  drives.forEach((drive) => {\n    console.log(drive);\n  });\n});\n```\n\nTests\n-----\n\nRun the test suite by doing:\n\n```sh\n$ npm test\n```\n\nContribute\n----------\n\nWe're looking forward to support more operating systems. Please raise an issue or even better, send a PR to increase support!\n\n- Issue Tracker: [github.com/resin-io-modules/drivelist/issues](https://github.com/resin-io-modules/drivelist/issues)\n- Source Code: [github.com/resin-io-modules/drivelist](https://github.com/resin-io-modules/drivelist)\n\nBefore submitting a PR, please make sure that you include tests, and that the linter runs without any warning:\n\n```sh\n$ npm run lint\n```\n\nExecute the following command after making any changes to the platform scripts:\n\n```sh\nnpm run compile-scripts\n```\n\nSupport\n-------\n\nIf you're having any problem, please [raise an issue](https://github.com/resin-io-modules/drivelist/issues/new) on GitHub.\n\nLicense\n-------\n\nThe project is licensed under the Apache 2.0 license.\n\n[yaml]: http://yaml.org\n","maintainers":[{"name":"zkochan","email":"zoltan.kochan@gmail.com"}],"time":{"modified":"2022-05-25T15:03:03.143Z","created":"2017-09-30T13:02:36.582Z","0.0.0":"2017-09-30T13:02:36.582Z"},"homepage":"https://github.com/resin-io-modules/drivelist","keywords":["disk","cross","platform","physical","drive","list"],"repository":{"type":"git","url":"git://github.com/resin-io-modules/drivelist.git"},"author":{"name":"Juan Cruz Viotti","email":"juan@resin.io"},"bugs":{"url":"https://github.com/resin-io-modules/drivelist/issues"},"license":"Apache-2.0","readmeFilename":"README.md"}