code: function spawn (options, mocks) {
    const Handbrake = require('./lib/Handbrake')
    const handbrake = new Handbrake(mocks)
  
    /* defer so the caller can attach event listers on the returned Handbrake instance first */
    process.nextTick(function () {
      try {
        handbrake.options = options
        handbrake._run()
      } catch (error) {
        const err = new Error()
        err.message = error.message
        err.name = 'InvalidOption'
        handbrake._emitError(err)
      }
    })
  
    return handbrake
  }
docs: Spawns a HandbrakeCLI process with the supplied [options](https://handbrake.fr/docs/en/latest/cli/cli-guide.html#options), returning an instance of `Handbrake` on which you can listen for events.
  
  @param {object} [options] - [Options](https://handbrake.fr/docs/en/latest/cli/cli-guide.html#options) to pass directly to HandbrakeCLI
  @returns {module:handbrake-js~Handbrake}
  @alias module:handbrake-js.spawn
  @example
  ```js
  const hbjs = require('handbrake-js')
  
  const options = {
  input: 'something.avi',
  output: 'something.mp4',
  preset: 'Normal',
  rotate: 1
  }
  hbjs.spawn(options)
  .on('error', console.error)
  .on('output', console.log)
  ```