import Drive from './classes/drive' ; import { Darwin } from './platforms/darwin' ; import { Linux } from './platforms/linux' ; import { Windows } from './platforms/windows' ; import { Utils } from './utils/utils' ; author Cristiam Mercado
 *  return { Promise < Drive [ ] > } export function getDiskInfo ( ) { return new Promise ( ( resolve , reject ) => { try { const platform = Utils . detectPlatform ( ) ; let drivesInfo ; switch ( platform ) { case 'aix' : reject ( new Error ( `Platform not supported: ${ platform }` ) ) ; break ; case 'android' : reject ( new Error ( `Platform not supported: ${ platform }` ) ) ; break ; case 'darwin' : drivesInfo = Darwin . run ( ) ; resolve ( drivesInfo ) ; break ; case 'freebsd' : drivesInfo = Darwin . run ( ) ; resolve ( drivesInfo ) ; break ; case 'linux' : drivesInfo = Linux . run ( ) ; resolve ( drivesInfo ) ; break ; case 'openbsd' : drivesInfo = Darwin . run ( ) ; resolve ( drivesInfo ) ; break ; case 'sunos' : reject ( new Error ( `Platform not supported: ${ platform }` ) ) ; break ; case 'win32' : drivesInfo = Windows . run ( ) ; resolve ( drivesInfo ) ; break ; default : reject ( new Error ( `Platform not recognized: ${ platform }` ) ) ; } } catch ( e ) { reject ( e ) ; } } ) ; } author Cristiam Mercado
 *  return { Drive [ ] } throws export function getDiskInfoSync ( ) { const platform = Utils . detectPlatform ( ) ; let drivesInfo ; switch ( platform ) { case 'aix' : throw new Error ( "Platform not supported: " + platform ) ; case 'android' : throw new Error ( "Platform not supported: " + platform ) ; case 'darwin' : drivesInfo = Darwin . run ( ) ; return drivesInfo ; case 'freebsd' : drivesInfo = Darwin . run ( ) ; return drivesInfo ; case 'linux' : drivesInfo = Linux . run ( ) ; return drivesInfo ; case 'openbsd' : drivesInfo = Darwin . run ( ) ; return drivesInfo ; case 'sunos' : throw new Error ( "Platform not supported: " + platform ) ; case 'win32' : drivesInfo = Windows . run ( ) ; return drivesInfo ; default : throw new Error ( "Platform not recognized: " + platform ) ; } }