npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@rdproject/json-tools

v1.0.0

Published

A simple logger and JSON utility toolkit

Readme

@rdproject/json-tools

A lightweight utility library for working with JSON files and logging in Node.js (ES Modules).


📦 Installation

npm install @rdproject/json-tools

🚀 Features

  • Async JSON file read/write utilities
  • Safe fallback handling for missing files
  • Simple configurable logger
  • Log levels (ERROR, WARN, INFO, DEBUG)
  • ES Modules support
  • Zero dependencies (except Node built-in fs)

📁 Structure

src/
  jsonHelper.js
  LoggerUtil.js

📌 Logger Usage

Import logger

import LoggerUtil, { LOG_LEVELS, logger } from "@rdproject/json-tools/logger";

Create your own logger

const myLogger = new LoggerUtil(LOG_LEVELS.DEBUG);

myLogger.info("App started");
myLogger.warn("Something suspicious");
myLogger.error("Something failed");
myLogger.debug("Debug info");

Change log level

myLogger.setLogLevel(LOG_LEVELS.ERROR);

Default singleton logger

import { logger } from "@rdproject/json-tools/logger";

logger.info("Using global logger");

📄 JSON Helpers

Import functions

import {
  readJsonFile,
  writeJsonFile
} from "@rdproject/json-tools/jsonHelper";

📥 Read JSON file

const data = await readJsonFile("./data.json", []);
console.log(data);
  • Returns parsed JSON
  • If file does not exist → returns fallback value

📤 Write JSON file

await writeJsonFile("./data.json", { name: "RDProject" });
  • Automatically formats JSON (pretty print)
  • Overwrites existing file

⚙️ Error handling

  • Missing file (ENOENT) → returns fallback
  • Other errors → logged via LoggerUtil + fallback returned

🧠 Design notes

This package is designed for:

  • Node.js environments
  • ESM (import/export)
  • Simple file-based JSON workflows
  • Lightweight logging without external dependencies

📦 Dependencies

None (uses Node.js built-in fs/promises)


📜 License

MIT © RDProject


👨‍💻 Author

RDProject [email protected]