Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

drive-by-path

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

drive-by-path - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

6

index.d.ts
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,

'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:**

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc