Back to Blog

Building Privacy-First Browser Tools with WebAssembly

February 20, 2026by Ichiban Team
webassemblyprivacybrowserjavascript

#クライアントサイドでのPDF操作

PDFエディタにはpdf-libを活用している。これはサーバーとの通信を一切行わずにPDFの作成や編集が可能な、純粋なJavaScriptライブラリである。

import { PDFDocument } from 'pdf-lib';

const pdfDoc = await PDFDocument.load(existingPdfBytes);
const pages = pdfDoc.getPages();
const firstPage = pages[0];

firstPage.drawText('Hello, World!', {
  x: 50,
  y: firstPage.getHeight() - 100,
  size: 30,
});

#Transformers.jsによるオンデバイスAI

要約ツールと翻訳ツールにはHugging Face Transformers.jsを使用している。WebAssemblyとWebGPUを介して、AIモデルをブラウザ上で直接実行する仕組みだ。

import { pipeline } from '@huggingface/transformers';

const summarizer = await pipeline(
  'summarization', 
  'Xenova/distilbart-cnn-12-6'
);
const result = await summarizer(longText, {
  max_length: 130,
  min_length: 30,
});