dmg-utils

Util lib for DMG files.

Usage no npm install needed!

<script type="module">
  import dmgUtils from 'https://cdn.skypack.dev/dmg-utils';
</script>

README

dmg-utils [WIP]

Util lib for DMG files.

npm libera manifesto

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