<commit_before>import WebworkerPromise from 'webworker-promise'

import config from './itkConfig'

import IOTypes from 'IOTypes'

const worker = new window.Worker(
  config.itkModulesPath + '/WebWorkers/Pipeline.worker.js'
)
const promiseWorker = new WebworkerPromise(worker)

const runPipelineBrowser = (pipelinePath, args, outputs, inputs) => {
  const transferables = []
  if (inputs) {
    inputs.forEach(function (input) {
      // Binary data
      if (input.type === IOTypes.Binary) {
        if (input.data.buffer) {
          transferables.push(input.data.buffer)
        } else if (input.data.byteLength) {
          transferables.push(input.data)
        }
      }
      // Image data
      if (input.type === IOTypes.Image) {
        if (input.data.data.buffer) {
          transferables.push(input.data.data.buffer)
        } else if (input.data.data.byteLength) {
          transferables.push(input.data.data)
        }
      }
    })
  }
  return promiseWorker.postMessage(
    {
      operation: 'runPipeline',
      config: config,
      pipelinePath,
      args,
      outputs,
      inputs
    },
    transferables
  )
}

export default runPipelineBrowser
<commit_msg>fix(runPipelineBrowser): Fix IOTypes path when used as a package<commit_after>import WebworkerPromise from 'webworker-promise'

import config from './itkConfig'

import IOTypes from './IOTypes'

const worker = new window.Worker(
  config.itkModulesPath + '/WebWorkers/Pipeline.worker.js'
)
const promiseWorker = new WebworkerPromise(worker)

const runPipelineBrowser = (pipelinePath, args, outputs, inputs) => {
  const transferables = []
  if (inputs) {
    inputs.forEach(function (input) {
      // Binary data
      if (input.type === IOTypes.Binary) {
        if (input.data.buffer) {
          transferables.push(input.data.buffer)
        } else if (input.data.byteLength) {
          transferables.push(input.data)
        }
      }
      // Image data
      if (input.type === IOTypes.Image) {
        if (input.data.data.buffer) {
          transferables.push(input.data.data.buffer)
        } else if (input.data.data.byteLength) {
          transferables.push(input.data.data)
        }
      }
    })
  }
  return promiseWorker.postMessage(
    {
      operation: 'runPipeline',
      config: config,
      pipelinePath,
      args,
      outputs,
      inputs
    },
    transferables
  )
}

export default runPipelineBrowser

{'fraction_non_alphanumeric': 0.11248454882571075, 'fraction_numerical': 0.0, 'mean_word_length': 2.4835007173601147, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4791741', 'n_tokens_mistral': 730, 'n_tokens_neox': 742, 'n_words': 152}