This commit is contained in:
2017-06-09 01:24:19 +02:00
parent b269a05b3f
commit fbf107c3c7
20 changed files with 527 additions and 24 deletions

4
ts/index.ts Normal file
View File

@ -0,0 +1,4 @@
import * as plugins from './smartdrive.plugins'
export * from './smartdrive.classes.localdrivelist'
export * from './smartdrive.interfaces'

View File

@ -0,0 +1,20 @@
import * as plugins from './smartdrive.plugins'
import { IDrive } from './smartdrive.interfaces'
let promisifiedDrivelist = plugins.smartq.promisify<any>(plugins.drivelist.list)
export class LocalDriveList {
private _list: IDrive[] = null
async getList (): Promise<IDrive[]> {
if (!this._list) {
this._list = await promisifiedDrivelist()
}
return this._list
}
async getUpdatedList (): Promise<IDrive[]> {
this._list = null
return await this.getList()
}
}

View File

@ -0,0 +1,15 @@
import * as plugins from './smartdrive.plugins'
export interface IDrive {
device: string
description: string
size: number,
mountpoints: IMountpoint[]
raw: string
protected: boolean
system: boolean
}
export interface IMountpoint {
path: string
}

8
ts/smartdrive.plugins.ts Normal file
View File

@ -0,0 +1,8 @@
import 'typings-global'
import * as drivelist from 'drivelist'
import * as smartq from 'smartq'
export {
drivelist,
smartq
}