https://github.com/exuanbo/dmg-utils
Util lib for DMG files.
https://github.com/exuanbo/dmg-utils
dmg nodejs
Last synced: 2 months ago
JSON representation
Util lib for DMG files.
- Host: GitHub
- URL: https://github.com/exuanbo/dmg-utils
- Owner: exuanbo
- License: mit
- Created: 2020-10-27T22:41:53.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-02-14T22:32:05.000Z (over 5 years ago)
- Last Synced: 2025-09-06T23:59:50.160Z (9 months ago)
- Topics: dmg, nodejs
- Language: TypeScript
- Homepage:
- Size: 61.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dmg-utils [WIP]
> Util lib for DMG files.
[](https://www.npmjs.com/package/dmg-utils)
[](https://liberamanifesto.com)
By now it only works on macOS.
## Install
```sh
npm install dmg-utils
```
## API
### mount
```ts
declare const mount: (
dmgPath: string,
callback?: ((volumePath: string) => void) | undefined
) => Promise
```
Returns mounted volume path.
### unmount
```ts
declare const unmount: (
volumePath: string,
callback?: (() => void) | undefined
) => Promise
```
### extract
```ts
declare const extract: (dmgPath: string, destPath: string) => Promise
```
Uses `copy` from `fs-extra`.
### generateCommand
```ts
declare type Action = 'mount -nobrowse' | 'unmount'
declare type Command = `hdiutil ${Action} "${string}"`
declare const generateCommand: ({
mount
}: {
mount: boolean
}) => (path: string) => Command
```
```js
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](https://github.com/exuanbo/dmg-utils/blob/main/LICENSE) © 2020 [Exuanbo](https://github.com/exuanbo)