Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

appdmg

Package Overview
Dependencies
Maintainers
2
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

appdmg

Generate beautiful DMG-images for your OS X applications.

  • 0.4.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
16K
decreased by-13.55%
Maintainers
2
Weekly downloads
 
Created
Source

node-appdmg

Generate beautiful DMG-images for your OS X applications.

Installation

npm install -g appdmg

Usage

appdmg <json-path> <dmg-path>
  • json-path: Path to the JSON Specification file
  • dmg-path: Path at which to place the final DMG

Test

To produce a test DMG to your desktop, run the following command:

appdmg test/appdmg.json ~/Desktop/test.dmg

JSON Specification

Visualization

The specification for the image is a simple json file, example provided below. All paths are relative to the json-file's path. (Comments are not allowed, I'm only using them for demonstration purposes.)

{

  // The title of the produced DMG, which will be shown when mounted
  "title": "Test Title",

  // Path to your icon, which will be shown when mounted
  "icon": "TestIcon.icns",

  // Path to your background
  "background": "TestBkg.png",

  // Background color (accepts css colors)
  "background-color": "mintcream",

  // Size of all the icons inside the DMG
  "icon-size": 80,

  // Window options
  "window": {
    // Position when opened
    "position": { "x": 250, "y": 250 },

    // Window size
    "size": { "width": 500, "height": 500 }
  },

  "contents": [

    // This is the contents of your DMG.

    // Each entry has a position specified by
    // X and Y in the center of its icon.

    // `type: link` creates a link to the specified target
    { "x": 448, "y": 344, "type": "link", "path": "/Applications" },

    // `type: file` adds a file to the DMG
    { "x": 192, "y": 344, "type": "file", "path": "TestApp.app" },
    { "x": 512, "y": 128, "type": "file", "path": "TestDoc.txt" }

  ]

}

0.1.x used a different format on the specification. This format is still supported but deprecated, please update your json.

Retina background

Finder can display retina backgrounds if packaged correctly into a .tiff file. appdmg will do this for you automatically if it can find a file with the same name as the background appended with @2x.

E.g. if the json contains "background": "TestBkg.png" then add a file with the name TestBkg@2x.png into the same folder.

Image format

The specification also accepts an optional format field specifying which format the resulting image should be in. The following values are accepted:

  • UDRW - UDIF read/write image
  • UDRO - UDIF read-only image
  • UDCO - UDIF ADC-compressed image
  • UDZO - UDIF zlib-compressed image
  • UDBZ - UDIF bzip2-compressed image (OS X 10.4+ only)
  • ULFO - UDIF lzfse-compressed image (OS X 10.11+ only)

API

The application can also be called from within another javascript file, example:


var appdmg = require('appdmg');
var ee = appdmg({ source: 'test/appdmg.json', target: 'test.dmg' });

ee.on('progress', function (info) {

  // info.current is the current step
  // info.total is the total number of steps
  // info.type is on of 'step-begin', 'step-end'

  // 'step-begin'
  // info.title is the title of the current step

  // 'step-end'
  // info.status is one of 'ok', 'skip', 'fail'

});

ee.on('finish', function () {
  // There now is a `test.dmg` file
});

ee.on('error', function (err) {
  // An error occurred
});

You can also pass in the specification directly instead of reading it from a file. basepath should be a path which will be used to resolve other paths in the specification.

var ee = appdmg({
  target: 'test.dmg',
  basepath: __dirname,
  specification: {
    "title": "Test Title",
    // ...
  }
});

OS Support

Currently the only supported os is Mac OS X.

Track the status of this here: https://github.com/LinusU/node-appdmg/issues/14

Alternatives

FAQs

Package last updated on 17 May 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc