Back to Hub
FILE SYSTEMS • MAY 2026

Native File Watching with FileSystemObserver.

When you edit a local file in a desktop IDE like VS Code, the editor instantly knows if an external program (like Git or a build script) modified that file. It achieves this using native OS event listeners like inotify on Linux or FSEvents on macOS. Historically, web browsers had no access to these hardware-level events, forcing web apps to use setInterval to manually poll the disk for changes—a process that destroys battery life.

NitroIDE completely eliminates disk polling. By implementing the bleeding-edge FileSystemObserver API, we hook directly into your operating system's native file-watching architecture from inside the browser sandbox.

Event-Driven OS Hooks

Instead of aggressively reading the file metadata every 500ms, the FileSystemObserver allows NitroIDE to register a callback that the browser's C++ engine only fires when the OS explicitly broadcasts a file mutation event.

// Attaching an observer to a local directory handle
const observer = new FileSystemObserver((records) => {
  for (const record of records) {
    if (record.type === 'modified') {
      console.log(`External modification detected: ${record.changedHandle.name}`);
      promptReload(record.changedHandle);
    }
  }
});

// Watch the directory and all of its nested subdirectories natively
await observer.observe(projectDirHandle, { recursive: true });

Debouncing the OS: Operating systems are incredibly noisy. Saving a single file might trigger three separate 'modified' events (metadata update, content write, file close). NitroIDE implements an intelligent 50ms debounce layer over the observer to guarantee the Monaco editor only reloads the buffer once the OS lock is fully released.

The Multi-Editor Workflow

This API unlocks true professional workflows. You can have NitroIDE open in Chrome, while running a heavy Webpack or Vite build script in your native terminal. The moment the build script generates a new bundle.js on your hard drive, NitroIDE's file explorer updates instantaneously, bridging the gap between the web and your local machine.

Watch Your Files Sync.

Mount a local folder, modify a file in Notepad, and watch NitroIDE update instantly.

Mount Directory