UNPKG

rjweb-server

Version:

Easy and Robust Way to create a Web Server with Many Easy-to-use Features in NodeJS

11 lines (10 loc) 267 B
const decoder = new TextDecoder(); /** * Convert Buffers to ArrayBuffers to strings * @since 9.0.0 */ export default function toString(input) { if (input instanceof Buffer) return input.toString('utf8'); else return decoder.decode(input); }