drive-by-path
Advanced tools
Comparing version 0.0.1 to 0.0.2
export = driveByPath; | ||
declare function driveByPath (filepath: string, cwd?: string): Promise<{ | ||
mountpointPath: string, | ||
drive: driveByPath.Drive, | ||
}>; | ||
declare function driveByPath (filepath: string, cwd?: string): Promise<driveByPath.Drive>; | ||
declare namespace driveByPath { | ||
type Drive = { | ||
matchedMountpointPath: string, | ||
device: string, | ||
@@ -11,0 +9,0 @@ displayName: string, |
12
index.js
'use strict' | ||
const _drivelist = require('drivelist') | ||
const _drivelist = require('zkochan-drivelist') | ||
const promisify = require('util.promisify') | ||
@@ -17,3 +17,11 @@ const once = require('once') | ||
return drivesByMountpoints() | ||
.then(drives => drives.find(drive => isSubdir(drive.mountpointPath, path))) | ||
.then(drives => { | ||
const match = drives.find(drive => isSubdir(drive.mountpointPath, path)) | ||
if (!match) { | ||
return null | ||
} | ||
return Object.assign({}, match.drive, { | ||
matchedMountpointPath: match.mountpointPath | ||
}) | ||
}) | ||
} | ||
@@ -20,0 +28,0 @@ |
{ | ||
"name": "drive-by-path", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Returns the drive to which a path belongs", | ||
@@ -39,7 +39,7 @@ "main": "index.js", | ||
"dependencies": { | ||
"drivelist": "github:zkochan/drivelist", | ||
"is-subdir": "^1.0.1", | ||
"once": "^1.4.0", | ||
"ramda": "^0.24.1", | ||
"util.promisify": "^1.0.0" | ||
"util.promisify": "^1.0.0", | ||
"zkochan-drivelist": "^0.0.0" | ||
}, | ||
@@ -46,0 +46,0 @@ "devDependencies": { |
@@ -24,8 +24,6 @@ # drive-by-path | ||
//> { | ||
// drive: { | ||
// device: '/dev/disk0', | ||
// displayName: '/dev/disk0', | ||
// ... | ||
// }, | ||
// mountpointPath: '/' | ||
// matchedMountpointPath: '/' | ||
// device: '/dev/disk0', | ||
// displayName: '/dev/disk0', | ||
// ... | ||
// } | ||
@@ -36,6 +34,7 @@ ``` | ||
### `driveByPath(path): Promise<{drive, mountpoint}>` | ||
### `driveByPath(path): Promise<DriveInfo>` | ||
Returns info abouth the drive and the mountpoint under which the path is located. | ||
One drive can have multiple mountpoints. | ||
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. | ||
@@ -42,0 +41,0 @@ **Arguments:** |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
GitHub dependency
Supply chain riskContains a dependency which resolves to a GitHub URL. Dependencies fetched from GitHub specifiers are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
4707
54
0
46
+ Addedzkochan-drivelist@^0.0.0
+ Addedansi-regex@2.1.1(transitive)
+ Addedaproba@1.2.0(transitive)
+ Addedare-we-there-yet@1.1.7(transitive)
+ Addedargparse@1.0.10(transitive)
+ Addedbindings@1.5.0(transitive)
+ Addedbl@1.2.3(transitive)
+ Addedbuffer-alloc@1.2.0(transitive)
+ Addedbuffer-alloc-unsafe@1.1.0(transitive)
+ Addedbuffer-fill@1.0.0(transitive)
+ Addedchownr@1.1.4(transitive)
+ Addedcode-point-at@1.1.0(transitive)
+ Addedconsole-control-strings@1.1.0(transitive)
+ Addedcore-util-is@1.0.3(transitive)
+ Addeddebug@3.2.7(transitive)
+ Addeddecompress-response@3.3.0(transitive)
+ Addeddeep-extend@0.6.0(transitive)
+ Addeddelegates@1.0.0(transitive)
+ Addeddetect-libc@1.0.3(transitive)
+ Addedend-of-stream@1.4.4(transitive)
+ Addedesprima@4.0.1(transitive)
+ Addedexpand-template@1.1.1(transitive)
+ Addedfile-uri-to-path@1.0.0(transitive)
+ Addedfs-constants@1.0.0(transitive)
+ Addedgauge@2.7.4(transitive)
+ Addedgithub-from-package@0.0.0(transitive)
+ Addedhas-unicode@2.0.1(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedini@1.3.8(transitive)
+ Addedis-fullwidth-code-point@1.0.0(transitive)
+ Addedisarray@1.0.0(transitive)
+ Addedjs-yaml@3.14.1(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedmimic-response@1.0.1(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedmkdirp@0.5.6(transitive)
+ Addedms@2.1.3(transitive)
+ Addednan@2.22.0(transitive)
+ Addednode-abi@2.30.1(transitive)
+ Addednoop-logger@0.1.1(transitive)
+ Addednpmlog@4.1.2(transitive)
+ Addednumber-is-nan@1.0.1(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedos-homedir@1.0.2(transitive)
+ Addedprebuild-install@2.5.3(transitive)
+ Addedprocess-nextick-args@2.0.1(transitive)
+ Addedpump@1.0.32.0.1(transitive)
+ Addedrc@1.2.8(transitive)
+ Addedreadable-stream@2.3.8(transitive)
+ Addedsafe-buffer@5.1.2(transitive)
+ Addedsemver@5.7.2(transitive)
+ Addedset-blocking@2.0.0(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedsimple-concat@1.0.1(transitive)
+ Addedsimple-get@2.8.2(transitive)
+ Addedsprintf-js@1.0.3(transitive)
+ Addedstring-width@1.0.2(transitive)
+ Addedstring_decoder@1.1.1(transitive)
+ Addedstrip-ansi@3.0.1(transitive)
+ Addedstrip-json-comments@2.0.1(transitive)
+ Addedtar-fs@1.16.3(transitive)
+ Addedtar-stream@1.6.2(transitive)
+ Addedto-buffer@1.1.1(transitive)
+ Addedtunnel-agent@0.6.0(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedwhich-pm-runs@1.1.0(transitive)
+ Addedwide-align@1.1.5(transitive)
+ Addedxtend@4.0.2(transitive)
+ Addedzkochan-drivelist@0.0.0(transitive)
- Removeddrivelist@github:zkochan/drivelist