
Research
Node.js Fixes AsyncLocalStorage Crash Bug That Could Take Down Production Servers
Node.js patched a crash bug where AsyncLocalStorage could cause stack overflows to bypass error handlers and terminate production servers.
@assistant-ui/local-pdf-adapter
Advanced tools
A standalone PDF attachment adapter for @assistant-ui/react that provides native PDF text extraction support.
npm install local-pdf-adapter
This package requires:
@assistant-ui/react (peer dependency)pdfjs-dist (for browser environments)For Node.js environments, also install:
npm install pdf-parse
import { LocalPDFAttachmentAdapter } from 'local-pdf-adapter';
import { CompositeAttachmentAdapter } from '@assistant-ui/react';
const pdfAdapter = new LocalPDFAttachmentAdapter();
// Use with CompositeAttachmentAdapter
const attachmentAdapter = new CompositeAttachmentAdapter([
pdfAdapter,
// Add other adapters as needed
]);
// Use in your runtime
const runtime = useLocalRuntime({
attachmentAdapter,
});
const pdfAdapter = new LocalPDFAttachmentAdapter({
maxFileSize: 20 * 1024 * 1024, // 20MB limit
workerSrc: '/pdf.worker.min.mjs', // Self-hosted worker
});
LocalPDFAttachmentAdapterConfig| Option | Type | Default | Description |
|---|---|---|---|
workerSrc | string | undefined | Custom URL for PDF.js worker script. If not provided, uses unpkg CDN |
maxFileSize | number | 10 * 1024 * 1024 (10MB) | Maximum file size in bytes |
By default, the PDF.js worker is loaded from the unpkg CDN. For production applications, consider self-hosting:
const pdfAdapter = new LocalPDFAttachmentAdapter({
workerSrc: '/pdf.worker.min.mjs'
});
If using the default CDN, add it to your Content Security Policy:
script-src https://unpkg.com/pdfjs-dist@*
pdfjs-dist for client-side PDF processingpdf-parse for server-side PDF processingpdf-parse dependencyThe adapter handles various error scenarios:
import {
LocalRuntime,
CompositeAttachmentAdapter,
useLocalRuntime
} from '@assistant-ui/react';
import { LocalPDFAttachmentAdapter } from 'local-pdf-adapter';
function ChatComponent() {
const attachmentAdapter = new CompositeAttachmentAdapter([
new LocalPDFAttachmentAdapter({
maxFileSize: 5 * 1024 * 1024, // 5MB limit
workerSrc: '/assets/pdf.worker.min.mjs' // Self-hosted
}),
// Add other adapters for images, text, etc.
]);
const runtime = useLocalRuntime({
attachmentAdapter,
});
return (
<ThreadContainer runtime={runtime}>
<Viewport>
<ThreadWelcome />
<ThreadMessages />
<ThreadComposer />
</Viewport>
</ThreadContainer>
);
}
# Install dependencies
npm install
# Run tests
npm test
# Build the package
npm run build
# Watch mode for development
npm run dev
MIT
Contributions are welcome! Please feel free to submit a Pull Request.
FAQs
Local PDF attachment adapter for @assistant-ui/react
We found that @assistant-ui/local-pdf-adapter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

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.

Research
Node.js patched a crash bug where AsyncLocalStorage could cause stack overflows to bypass error handlers and terminate production servers.

Research
/Security News
A malicious Chrome extension steals newly created MEXC API keys, exfiltrates them to Telegram, and enables full account takeover with trading and withdrawal rights.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.