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

coursevault-preview

v0.1.1

Published

Preview course material files from a configured directory

Downloads

303

Readme

coursevault-preview

A small utility for previewing course material files from a configured directory. Useful for internal tooling in a university setting where you need to inspect .txt, .md, and .json files from a consistent base path.

Installation

npm install coursevault-preview

Library API

import { createCoursevaultPreview } from "coursevault-preview";

const vault = createCoursevaultPreview({
  baseDir: "/path/to/course-materials",
});

// List all files recursively
const files = await vault.listFiles();
// → ["course-config.json", "notes.txt", "syllabus.md", "week1/lecture.txt"]

// Get file metadata
const meta = await vault.getFileMetadata("syllabus.md");
// → { relativePath: "syllabus.md", filename: "syllabus.md", extension: ".md",
//     sizeBytes: 842, modifiedAt: Date }

// Read raw file content
const raw = await vault.readFile("course-config.json");

// Preview a file (plain text, stripped markdown, or pretty-printed JSON)
const preview = await vault.previewFile("syllabus.md");
// → { relativePath: "syllabus.md", format: "md", content: "CS 401 ..." }

createCoursevaultPreview(options)

| Option | Type | Description | | --------- | -------- | --------------------------------------------- | | baseDir | string | Absolute path to the course materials directory |

Returns a CoursevaultPreview object with four async methods.

listFiles()

Returns a sorted array of relative file paths under baseDir, searched recursively.

getFileMetadata(relativePath)

Returns a FileMetadata object:

interface FileMetadata {
  relativePath: string;
  filename: string;
  extension: string;   // e.g. ".md"
  sizeBytes: number;
  modifiedAt: Date;
}

readFile(relativePath)

Returns the raw UTF-8 content of the file as a string.

previewFile(relativePath)

Returns a PreviewResult for supported file types (.txt, .md, .json):

interface PreviewResult {
  relativePath: string;
  format: "txt" | "md" | "json";
  content: string;
}
  • .txt — returned as-is.
  • .md — Markdown syntax is stripped; the result is a readable plain-text summary. No browser renderer.
  • .json — pretty-printed with 2-space indentation.

CLI

# List files (uses cwd as base, or pass --dir)
coursevault-preview --dir ./fixtures list

# Show file metadata
coursevault-preview --dir ./fixtures meta syllabus.md

# Print raw file content
coursevault-preview --dir ./fixtures read notes.txt

# Print a processed preview
coursevault-preview --dir ./fixtures preview course-config.json

All commands accept -d / --dir <path> to set the base directory. Defaults to the current working directory.

Development

npm install
npm run build      # compile TypeScript → dist/
npm test           # run unit tests with vitest
npm run typecheck  # tsc type-check without emitting
npm run lint       # eslint

The fixtures/ directory contains sample course files you can use for manual testing:

fixtures/
  notes.txt
  syllabus.md
  course-config.json
  week1/
    lecture.txt

License

MIT