Skip to content

Instantly share code, notes, and snippets.

View zhzLuke96's full-sized avatar
🥳
im thinking

len zhzLuke96

🥳
im thinking
View GitHub Profile
// debug server
import http from "http";
import { URL } from "url";
import { inspect } from "util";
const readBody = (req: http.IncomingMessage) =>
new Promise<Buffer>((resolve, reject) => {
const chunks: Buffer[] = [];
req.on("data", (chunk) => chunks.push(chunk));
req.on("end", () => resolve(Buffer.concat(chunks)));