document.filter

Run the rest of the branch only when the input matches format. Otherwise bytes pass through unchanged.

Config

type DocumentFilterConfig = {
  format: 'txt' | 'md'; // default 'txt'
};

There is no pdf option. PDF inputs never match this filter.

Example

// pipeline
{
  id: 'only-md',
  type: 'document.filter',
  config: { format: { value: 'md' } },
}

// queue
tk.runQueue(files, 'document')
  .filter({ format: 'md' })
  .convert({ format: 'txt' });