Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@r1-runtime/sw

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@r1-runtime/sw

Service Worker for R1 — handles asset:// URL interception and VFS asset loading.

latest
Source
npmnpm
Version
0.3.1
Version published
Maintainers
1
Created
Source

@r1-runtime/sw

Service Worker for R1 — handles asset:// URL interception and VFS asset loading.

Features

  • Asset Protocol: Intercepts asset:// URLs and serves files from VFS
  • OPFS Integration: Reads files from Origin Private File System
  • Automatic Registration: Registered automatically by @r1-runtime/core

Installation

npm install @r1-runtime/sw

Usage

This package is automatically used by @r1-runtime/core. You don't need to import or configure it manually.

The Service Worker is registered when you call:

import { R1Runtime } from '@r1-runtime/core';

const runtime = new R1Runtime();
await runtime.boot(); // Registers the Service Worker

What It Does

The Service Worker intercepts requests to the asset:// protocol and serves files from the Virtual File System:

// In your Rust code:
let content = std::fs::read_to_string("/app/assets/logo.png")?;

// In your frontend:
<img src="asset://localhost/app/assets/logo.png" />

The Service Worker:

  • Intercepts the asset:// request
  • Reads the file from OPFS at /app/assets/logo.png
  • Returns the file content with correct MIME type

Supported Protocols

  • asset://localhost/* - Maps to VFS root /
  • asset://embedded/* - Maps to embedded resources

MIME Types

The Service Worker automatically detects MIME types based on file extensions:

  • .htmltext/html
  • .csstext/css
  • .jsapplication/javascript
  • .jsonapplication/json
  • .pngimage/png
  • .jpg, .jpegimage/jpeg
  • .svgimage/svg+xml
  • .wasmapplication/wasm
  • And more...

Debugging

To see Service Worker logs, open DevTools → Application → Service Workers and check "Show console logs".

License

MIT © 2026 R1 Runtime Team

Keywords

tauri

FAQs

Package last updated on 19 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts