dmg-utils
v0.1.0
Published
Util lib for DMG files.
Downloads
4
Readme
dmg-utils [WIP]
Util lib for DMG files.
By now it only works on macOS.
Install
npm install dmg-utils
API
mount
declare const mount: (
dmgPath: string,
callback?: ((volumePath: string) => void) | undefined
) => Promise<string>
Returns mounted volume path.
unmount
declare const unmount: (
volumePath: string,
callback?: (() => void) | undefined
) => Promise<void>
extract
declare const extract: (dmgPath: string, destPath: string) => Promise<void>
Uses copy
from fs-extra
.
generateCommand
declare type Action = 'mount -nobrowse' | 'unmount'
declare type Command = `hdiutil ${Action} "${string}"`
declare const generateCommand: ({
mount
}: {
mount: boolean
}) => (path: string) => Command
import { generateCommand } from 'dmg-utils'
generateCommand({ mount: true })('./App.dmg')
// => 'hdiutil mount -nobrowse "./App.dmg"'
generateCommand({ mount: false })('/Volumes/App')
// => 'hdiutil unmount "/Volumes/App"'
License
MIT License © 2020 Exuanbo