(binary, encoding, skipped)
| 14 | - on reads: `Duplex.readable` `readableEncoding: null` default option |
| 15 | */ |
| 16 | export const getEncodingTransformGenerator = (binary, encoding, skipped) => { |
| 17 | if (skipped) { |
| 18 | return; |
| 19 | } |
| 20 | |
| 21 | if (binary) { |
| 22 | return {transform: encodingUint8ArrayGenerator.bind(undefined, new TextEncoder())}; |
| 23 | } |
| 24 | |
| 25 | const stringDecoder = new StringDecoder(encoding); |
| 26 | return { |
| 27 | transform: encodingStringGenerator.bind(undefined, stringDecoder), |
| 28 | final: encodingStringFinal.bind(undefined, stringDecoder), |
| 29 | }; |
| 30 | }; |
| 31 | |
| 32 | const encodingUint8ArrayGenerator = function * (textEncoder, chunk) { |
| 33 | if (Buffer.isBuffer(chunk)) { |
no outgoing calls
no test coverage detected