through.d.ts 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import extend = require('./extend');
  2. import stream = require('stream');
  3. declare namespace through {
  4. interface ThroughConstructor extends stream.Transform {
  5. new (opts?: stream.DuplexOptions): stream.Transform;
  6. (opts?: stream.DuplexOptions): stream.Transform;
  7. }
  8. type TransformCallback = (err?: any, data?: any) => void;
  9. type TransformFunction = (
  10. this: stream.Transform,
  11. chunk: any,
  12. enc: string,
  13. callback: TransformCallback
  14. ) => void;
  15. type FlushCallback = (
  16. this: stream.Transform,
  17. flushCallback: () => void
  18. ) => void;
  19. function obj(
  20. transform?: TransformFunction,
  21. flush?: FlushCallback
  22. ): stream.Transform;
  23. function ctor(
  24. transform?: TransformFunction,
  25. flush?: FlushCallback
  26. ): ThroughConstructor;
  27. function ctor(
  28. opts?: stream.DuplexOptions,
  29. transform?: TransformFunction,
  30. flush?: FlushCallback
  31. ): ThroughConstructor;
  32. }
  33. declare function through(
  34. transform?: through.TransformFunction,
  35. flush?: through.FlushCallback
  36. ): stream.Transform;
  37. declare function through(
  38. opts?: stream.DuplexOptions,
  39. transform?: through.TransformFunction,
  40. flush?: through.FlushCallback
  41. ): stream.Transform;
  42. export = through;