stream.d.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. /**
  2. * Create a duplex (readable and writable) stream.
  3. *
  4. * Some of the work to parse markdown can be done streaming, but in the
  5. * end buffering is required.
  6. *
  7. * micromark does not handle errors for you, so you must handle errors on whatever
  8. * streams you pipe into it.
  9. * As markdown does not know errors, `micromark` itself does not emit errors.
  10. *
  11. * @param {Options | null | undefined} [options]
  12. * Configuration (optional).
  13. * @returns {MinimalDuplex}
  14. * Duplex stream.
  15. */
  16. export function stream(options?: Options | null | undefined): MinimalDuplex
  17. export type Options = import('micromark-util-types').Options
  18. export type Value = import('micromark-util-types').Value
  19. export type Encoding = import('micromark-util-types').Encoding
  20. /**
  21. * Function called when write was successful.
  22. */
  23. export type Callback = () => undefined
  24. export type PipeOptions = {
  25. end?: boolean | null | undefined
  26. }
  27. export type MinimalDuplex = Omit<
  28. NodeJS.ReadableStream & NodeJS.WritableStream,
  29. | 'isPaused'
  30. | 'pause'
  31. | 'read'
  32. | 'resume'
  33. | 'setEncoding'
  34. | 'unpipe'
  35. | 'unshift'
  36. | 'wrap'
  37. >