drive-by-path

Returns the drive to which a path belongs

MIT 8 个版本
安装
npm install drive-by-path
yarn add drive-by-path
pnpm add drive-by-path
bun add drive-by-path
README

drive-by-path

Status Build status

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

License

MIT

版本列表
1.0.0 2017-10-06
0.1.2 2017-10-02
0.1.1 2017-10-01
0.1.0 2017-09-30
0.0.3 2017-09-30
0.0.2 2017-09-30
0.0.1 2017-09-30
0.0.0 2017-09-29