Skip to content

Instantly share code, notes, and snippets.

@guiseek
Created March 10, 2025 03:11
Show Gist options
  • Save guiseek/b24255345156d1dcfc2b69276d9b31fe to your computer and use it in GitHub Desktop.
Save guiseek/b24255345156d1dcfc2b69276d9b31fe to your computer and use it in GitHub Desktop.
NodeJS Console Table Logger
import { createWriteStream, PathLike } from "node:fs";
import { Console } from "node:console";
export const logger = <T>(path: PathLike, data: T[]) => {
const stream = createWriteStream(path);
const console = new Console(stream);
console.table(data);
stream.end();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment