concatenateToResponse.d.ts 1.0 KB

123456789101112131415161718192021222324
  1. import { StreamSource } from './_types.js';
  2. import './_version.js';
  3. /**
  4. * Takes multiple source Promises, each of which could resolve to a Response, a
  5. * ReadableStream, or a [BodyInit](https://fetch.spec.whatwg.org/#bodyinit),
  6. * along with a
  7. * [HeadersInit](https://fetch.spec.whatwg.org/#typedefdef-headersinit).
  8. *
  9. * Returns an object exposing a Response whose body consists of each individual
  10. * stream's data returned in sequence, along with a Promise which signals when
  11. * the stream is finished (useful for passing to a FetchEvent's waitUntil()).
  12. *
  13. * @param {Array<Promise<module:workbox-streams.StreamSource>>} sourcePromises
  14. * @param {HeadersInit} [headersInit] If there's no `Content-Type` specified,
  15. * `'text/html'` will be used by default.
  16. * @return {Object<{done: Promise, response: Response}>}
  17. *
  18. * @memberof module:workbox-streams
  19. */
  20. declare function concatenateToResponse(sourcePromises: Promise<StreamSource>[], headersInit: HeadersInit): {
  21. done: Promise<void>;
  22. response: Response;
  23. };
  24. export { concatenateToResponse };