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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@fullstackcraftllc/codevideo-virtual-file-explorer

v1.0.33

Published

TypeScript class that simulates a file explorer in an IDE.

Downloads

53

Readme

@fullstackcraft/codevideo-virtual-file-explorer

NPM Version

codevideo-virtual-file-explorer is a TypeScript class that simulates an IDE file explorer with the ability to create, delete, and modify folder and file structures. This lightweight and versatile library is ideal for building educational tools, code playgrounds, and interactive coding environments within web applications.

This library heavily relies on the types from codevideo-types

Example Usage

import { VirtualFileExplorer } from '@fullstackcraftllc/codevideo-virtual-file-explorer';
import { advancedCommandSeparator } from '@fullstackcraftllc/codevideo-types';

// Initialize a VirtualFileExplorer instance
const virtualFileExplorer = new VirtualFileExplorer();

// Apply file explorer actions
virtualFileExplorer.applyActions([
  // create a test.js file
  { name: 'create-file', value: 'test.js' },
  
  // creates a src folder
  { name: 'create-folder', value: 'src' },
  
  // create an index.js file in the src folder
  { name: 'create-file', value: 'src/index.js' },
  
  // rename test.js to main.js
  { name: 'rename-file', value: `test.js${advancedCommandSeparator}main.js` },
  
  // copy index.js
  { name: 'copy-file', value: `src/index.js${advancedCommandSeparator}src/index.backup.js` },
  
  // move main.js into src
  { name: 'move-file', value: `main.js${advancedCommandSeparator}src/main.js` },
  
  // create components folder
  { name: 'create-folder', value: 'src/components' },
  
  // copy components folder
  { name: 'copy-folder', value: `src/components${advancedCommandSeparator}src/shared` },
  
  // move shared folder to root
  { name: 'move-folder', value: `src/shared${advancedCommandSeparator}shared` },
  
  // toggle src folder collapsed state
  { name: 'toggle-folder', value: 'src' },
  
  // delete backup file
  { name: 'delete-file', value: 'src/index.backup.js' },
  
  // delete shared folder
  { name: 'delete-folder', value: 'shared' },
]);

// Get the current state of the file explorer
const fileStructure = virtualFileExplorer.getCurrentFileStructure();
const fileTree = virtualFileExplorer.getCurrentFileTree();
const actionsApplied = virtualFileExplorer.getActionsApplied();

console.log('Current file tree:');
console.log(fileTree);
console.log('Actions applied:');
console.log(actionsApplied);

Available Actions

  • file-explorer-create-file: Create a new file
  • file-explorer-open-file: Open a file (UI handler)
  • file-explorer-rename-file: Rename a file using format "oldpath_____newpath"
  • file-explorer-delete-file: Delete a file
  • file-explorer-move-file: Move a file using format "oldpath_____newpath"
  • file-explorer-copy-file: Copy a file using format "sourcepath_____destpath"
  • file-explorer-create-folder: Create a new folder
  • file-explorer-rename-folder: Rename a folder using format "oldpath_____newpath"
  • file-explorer-delete-folder: Delete a folder
  • file-explorer-toggle-folder: Toggle folder's collapsed state
  • file-explorer-move-folder: Move a folder using format "oldpath_____newpath"
  • file-explorer-copy-folder: Copy a folder using format "sourcepath_____destpath"

Where "_____" is a separator string used for advanced commands. The separator string can be imported using the advancedCommandSeparator exported from @fullstackcraftllc/codevideo-types.

Available Methods

applyAction(action: FileExplorerAction): void

Apply a single action to the file structure.

applyActions(actions: FileExplorerAction[]): void

Apply a series of actions to the file structure.

getCurrentFileStructure(): IFileStructure

Get the current file structure as an object.

getCurrentFileTree(): string

Get a string representation of the current file tree.

getActionsApplied(): FileExplorerAction[]

Get the list of actions that were applied.

Why?

This library is part of the CodeVideo ecosystem, working alongside other tools to create a declarative way to build, edit, and generate step-by-step educational video software courses.

The VirtualFileExplorer provides a programmatic way to simulate file explorer interactions, making it perfect for:

  • Recording and replaying file operations
  • Creating educational content
  • Testing file-system related UI components
  • Simulating IDE-like environments in the browser

See more at codevideo.io