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

@holoscript/fs

v6.0.3

Published

File system library for HoloScript Plus

Downloads

156

Readme

@holoscript/fs

File system library for HoloScript Plus.

Installation

npm install @holoscript/fs

Entry Points

| Import | Description | | ---------------------- | ----------------- | | @holoscript/fs | All utilities | | @holoscript/fs/path | Path manipulation | | @holoscript/fs/watch | File watching |

File Operations

import {
  readText,
  writeText,
  readJson,
  writeJson,
  exists,
  mkdir,
  copy,
  move,
  remove,
} from '@holoscript/fs';

// Read & write
const code = await readText('scene.holo');
await writeText('output.js', compiled);

// JSON
const config = await readJson<Config>('holoscript.config.json');
await writeJson('stats.json', metrics, { pretty: true });

// Lines
const lines = await readLines('scene.holo');
await appendLine('log.txt', 'build complete');

// File operations
await ensureDir('dist/');
await copy('src/', 'backup/', { recursive: true });
await move('old.holo', 'new.holo');
await remove('temp/', true);

All read/write functions have sync variants (readTextSync, writeTextSync, etc.).

Directory Traversal

import { walk, glob, listFiles, listDirs, readDir } from '@holoscript/fs';

// Glob matching
const holoFiles = await glob('src/**/*.holo');

// Recursive walk (async generator)
for await (const entry of walk('src/')) {
  console.log(entry.name, entry.isFile);
}

// List contents
const files = await listFiles('src/');
const dirs = await listDirs('packages/');

Temporary Files

import { createTempFile, createTempDir } from '@holoscript/fs';

const { path, cleanup } = await createTempFile('hs-', '.holo');
await writeText(path, code);
// ... use temp file ...
cleanup();

Size Utilities

import { fileSize, dirSize, formatSize } from '@holoscript/fs';

const bytes = await fileSize('scene.holo');
const total = await dirSize('dist/');
console.log(formatSize(total)); // "1.5 MB"

Path Utilities

import {
  join,
  resolve,
  relative,
  dirname,
  basename,
  extname,
  normalize,
} from '@holoscript/fs/path';

join('src', 'scenes', 'lobby.holo');
dirname('/project/src/scene.holo'); // '/project/src'
extname('scene.holo'); // '.holo'

PathBuilder

Fluent API for path construction:

import { path } from '@holoscript/fs/path';

const out = path('src').join('scenes', 'lobby.holo').withExtension('.js').toString();
// 'src/scenes/lobby.js'

path.cwd().join('dist').sibling('build').value;

Additional Path Functions

import {
  toPosix,
  toWindows,
  hasExtension,
  changeExtension,
  segments,
  isChildOf,
  commonBase,
  expandHome,
  sanitize,
} from '@holoscript/fs/path';

toPosix('src\\scenes\\file.holo'); // 'src/scenes/file.holo'
hasExtension('scene.holo', '.holo'); // true
changeExtension('scene.holo', '.js'); // 'scene.js'
segments('src/scenes/lobby.holo'); // ['src', 'scenes', 'lobby.holo']
commonBase('src/a.holo', 'src/b.holo'); // 'src'
sanitize('my:file?.holo'); // 'myfile.holo'

File Watching

Built on chokidar:

import {
  watch,
  watchCallback,
  watchFile,
  watchFileTypes,
  watchDebounced,
} from '@holoscript/fs/watch';

// Basic watcher
const watcher = watch('src/', { ignored: ['**/node_modules/**'] });
watcher.on('change', (event) => console.log('changed:', event.path));
watcher.on('ready', () => console.log('watching...'));

// Callback-based
watchCallback('src/**/*.holo', (event) => {
  if (event.type === 'change') rebuild(event.path);
});

// Watch specific file types
watchFileTypes('src/', ['.holo', '.hsplus'], (event) => {
  console.log(`${event.type}: ${event.path}`);
});

// Debounced (batch rapid changes)
watchDebounced('src/', (event) => rebuild(), 300);

// One-shot (wait for first change)
const event = await watchOnce('config.json');

FileWatcher Class

import { FileWatcher } from '@holoscript/fs/watch';

const watcher = new FileWatcher(['src/', 'examples/'], {
  depth: 3,
  usePolling: false,
  debounce: 100,
});

watcher.start();
watcher.on('all', (event) => console.log(event.type, event.path));
watcher.add('tests/');
await watcher.stop();

Platform Utilities

import { cwd, homeDir, isWindows, isMacOS, isLinux } from '@holoscript/fs';

License

MIT