(inputStream, options)
| 1752 | } |
| 1753 | }; |
| 1754 | async function getStream3(inputStream, options) { |
| 1755 | if (!inputStream) { |
| 1756 | throw new Error("Expected a stream"); |
| 1757 | } |
| 1758 | options = { |
| 1759 | maxBuffer: Infinity, |
| 1760 | ...options |
| 1761 | }; |
| 1762 | const { maxBuffer } = options; |
| 1763 | const stream5 = bufferStream(options); |
| 1764 | await new Promise((resolve, reject) => { |
| 1765 | const rejectPromise = (error) => { |
| 1766 | if (error && stream5.getBufferedLength() <= BufferConstants.MAX_LENGTH) { |
| 1767 | error.bufferedData = stream5.getBufferedValue(); |
| 1768 | } |
| 1769 | reject(error); |
| 1770 | }; |
| 1771 | (async () => { |
| 1772 | try { |
| 1773 | await streamPipelinePromisified(inputStream, stream5); |
| 1774 | resolve(); |
| 1775 | } catch (error) { |
| 1776 | rejectPromise(error); |
| 1777 | } |
| 1778 | })(); |
| 1779 | stream5.on("data", () => { |
| 1780 | if (stream5.getBufferedLength() > maxBuffer) { |
| 1781 | rejectPromise(new MaxBufferError()); |
| 1782 | } |
| 1783 | }); |
| 1784 | }); |
| 1785 | return stream5.getBufferedValue(); |
| 1786 | } |
| 1787 | module2.exports = getStream3; |
| 1788 | module2.exports.buffer = (stream5, options) => getStream3(stream5, { ...options, encoding: "buffer" }); |
| 1789 | module2.exports.array = (stream5, options) => getStream3(stream5, { ...options, array: true }); |
no test coverage detected
searching dependent graphs…