1.0.0 • Published 7 years ago
drive-by-path v1.0.0
drive-by-path
Returns the drive to which a path belongs
Install
Install it via npm.
npm install drive-by-path
Usage
const driveByPath = require('drive-by-path')
driveByPath('/zkochan/foo')
.then(drive => console.log(drive))
//> {
// matchedMountpointPath: '/'
// device: '/dev/disk0',
// displayName: '/dev/disk0',
// ...
// }
API
driveByPath(path): Promise<DriveInfo>
Returns info abouth the drive under which the path is located.
Also returns what mountpoint was matched via matchedMountpointPath
:
one drive can have multiple mountpoints.
Arguments:
path
- string - the filepath for which the drive is searched