版博士V2.0程序
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

index.d.ts 2.5 KiB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. import { Duplex } from "readable-stream";
  2. import {
  3. BufferList as BL,
  4. BufferListConstructor,
  5. BufferListAcceptedTypes,
  6. } from "./BufferList";
  7. type BufferListStreamInit =
  8. | ((err: Error, buffer: Buffer) => void)
  9. | BufferListAcceptedTypes;
  10. interface BufferListStreamConstructor {
  11. new (initData?: BufferListStreamInit): BufferListStream;
  12. (callback?: BufferListStreamInit): BufferListStream;
  13. /**
  14. * Determines if the passed object is a BufferList. It will return true
  15. * if the passed object is an instance of BufferList or BufferListStream
  16. * and false otherwise.
  17. *
  18. * N.B. this won't return true for BufferList or BufferListStream instances
  19. * created by versions of this library before this static method was added.
  20. *
  21. * @param other
  22. */
  23. isBufferList(other: unknown): boolean;
  24. /**
  25. * Rexporting BufferList and BufferListStream to fix
  26. * issue with require/commonjs import and "export = " below.
  27. */
  28. BufferList: BufferListConstructor;
  29. BufferListStream: BufferListStreamConstructor;
  30. }
  31. interface BufferListStream extends Duplex, BL {
  32. prototype: BufferListStream & BL;
  33. }
  34. /**
  35. * BufferListStream is a Node Duplex Stream, so it can be read from
  36. * and written to like a standard Node stream. You can also pipe()
  37. * to and from a BufferListStream instance.
  38. *
  39. * The constructor takes an optional callback, if supplied, the
  40. * callback will be called with an error argument followed by a
  41. * reference to the bl instance, when bl.end() is called
  42. * (i.e. from a piped stream).
  43. *
  44. * This is a convenient method of collecting the entire contents of
  45. * a stream, particularly when the stream is chunky, such as a network
  46. * stream.
  47. *
  48. * Normally, no arguments are required for the constructor, but you can
  49. * initialise the list by passing in a single Buffer object or an array
  50. * of Buffer object.
  51. *
  52. * `new` is not strictly required, if you don't instantiate a new object,
  53. * it will be done automatically for you so you can create a new instance
  54. * simply with:
  55. *
  56. * ```js
  57. * const { BufferListStream } = require('bl');
  58. * const bl = BufferListStream();
  59. *
  60. * // equivalent to:
  61. *
  62. * const { BufferListStream } = require('bl');
  63. * const bl = new BufferListStream();
  64. * ```
  65. *
  66. * N.B. For backwards compatibility reasons, BufferListStream is the default
  67. * export when you `require('bl')`:
  68. *
  69. * ```js
  70. * const { BufferListStream } = require('bl')
  71. *
  72. * // equivalent to:
  73. *
  74. * const BufferListStream = require('bl')
  75. * ```
  76. */
  77. declare const BufferListStream: BufferListStreamConstructor;
  78. export = BufferListStream;