Back to Blog

Building Privacy-First Browser Tools with WebAssembly

February 20, 2026by Ichiban Team
webassemblyprivacybrowserjavascript

#纯前端 PDF 编辑

针对 PDF 编辑器,我们引入了 pdf-lib —— 这是一个纯 JavaScript 库,完全无需与服务器交互即可创建和修改 PDF:

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,
});

#运行在设备上的 AI:Transformers.js

我们的文本摘要和翻译工具采用了 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,
});