UNPKG

stream-chunks

Version:
17 lines (11 loc) 290 B
import { StringDecoder } from 'string_decoder' async function decode (stream, encoding) { const decoder = new StringDecoder(encoding) let str = '' for await (const chunk of stream) { str += decoder.write(chunk) } str += decoder.end() return str } export default decode