| 1694 | // node_modules/get-stream/buffer-stream.js |
| 1695 | var require_buffer_stream = __commonJS({ |
| 1696 | "node_modules/get-stream/buffer-stream.js"(exports2, module2) { |
| 1697 | "use strict"; |
| 1698 | var { PassThrough: PassThroughStream } = require("stream"); |
| 1699 | module2.exports = (options) => { |
| 1700 | options = { ...options }; |
| 1701 | const { array } = options; |
| 1702 | let { encoding } = options; |
| 1703 | const isBuffer2 = encoding === "buffer"; |
| 1704 | let objectMode = false; |
| 1705 | if (array) { |
| 1706 | objectMode = !(encoding || isBuffer2); |
| 1707 | } else { |
| 1708 | encoding = encoding || "utf8"; |
| 1709 | } |
| 1710 | if (isBuffer2) { |
| 1711 | encoding = null; |
| 1712 | } |
| 1713 | const stream4 = new PassThroughStream({ objectMode }); |
| 1714 | if (encoding) { |
| 1715 | stream4.setEncoding(encoding); |
| 1716 | } |
| 1717 | let length = 0; |
| 1718 | const chunks = []; |
| 1719 | stream4.on("data", (chunk) => { |
| 1720 | chunks.push(chunk); |
| 1721 | if (objectMode) { |
| 1722 | length = chunks.length; |
| 1723 | } else { |
| 1724 | length += chunk.length; |
| 1725 | } |
| 1726 | }); |
| 1727 | stream4.getBufferedValue = () => { |
| 1728 | if (array) { |
| 1729 | return chunks; |
| 1730 | } |
| 1731 | return isBuffer2 ? Buffer.concat(chunks, length) : chunks.join(""); |
| 1732 | }; |
| 1733 | stream4.getBufferedLength = () => length; |
| 1734 | return stream4; |
| 1735 | }; |
| 1736 | } |
| 1737 | }); |
| 1738 | |
| 1739 | // node_modules/get-stream/index.js |