mkiso
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

mkiso

Utility for creating ISO 9660 images

npm GitHub license Codacy Badge npm TypeScript

This library uses adapters built on burning command-line tools to generate ISO 9660 images from a source directory. In order to be able to use this module, make sure you have mkisofs installed on your linux system or hdiutil on your darwin system. It is also possible to use a custom adapter.

Installation


yarn add mkiso
npm i mkiso

Usage


The mkiso module returns a constructor that you can use to instanciate commands.

import mkiso from 'mkiso';
 
const cmd = mkiso(inputDirectorystring);

The following methods are available. Each of these methods can be apply before the exec() command.

label(name): set the volume name

mkiso(inputDirectorystring).label('my volume');

publisher(name): set the publisher name

mkiso(inputDirectorystring).publisher('Han Solo');

verbose(): enable the verbose mode

mkiso(inputDirectorystring).verbose();

output(target): set the iso output file path

mkiso will default to saving output image to the parent folder of input directory.

mkiso(inputDirectorystring).output('/path/to/image.iso');

adapter(adapter): Override the default adapter with a custom one

You can use an existing adapter into the adapters folder or link an external one.

mkiso(inputDirectorystring).adapter('mkisofs' | '/path/to/my/adapter');

exec(): start processing

This method must be called as a last instruction. Return a promise containing the stdout and the stderr

const res = await mkiso(inputDirectorystring)
  .label('my volume')
  .publisher('Han Solo')
  .output('/path/to/image.iso')
  .exec();

Setting event handlers

You can set event listeners for listening the process events. The following events are available:

'progress': stdout of process
'stderr': stderr of process
'error': ChildProcess.error
'close': ChildProcess.close
const res = await mkiso(inputDirectorystring)
  .output('/path/to/image.iso')
  .verbose()
  .on('error', err => console.error('Error:', err))
  .on('progress', msg => console.log('onProgress:', msg))
  .on('close', (code, signal) => console.log('onClose:', code, signal))
  .exec();

Package Sidebar

Install

npm i mkiso

Weekly Downloads

2

Version

0.1.1

License

MIT

Unpacked Size

524 kB

Total Files

22

Last publish

Collaborators

  • t4nz