A Vite plugin that enables importing binary files (images, videos, audio, etc.) as ArrayBuffer or Uint8Array directly in your JavaScript/TypeScript code. Version 0.1.4 is the latest stable release, with no scheduled release cadence. Unlike typical asset imports that return URLs or base64 strings, this plugin gives raw binary access, making it ideal for WebSocket streams, WebAssembly preprocessing, or custom binary formats. It is specifically designed for Vite's build system and does not work with other bundlers.
npm install vite-plugin-arraybufferVerified import paths — ran on the pinned version, not inferred.
Configures Vite to import .bin files as ArrayBuffer and .dat files as ArrayBuffer (default) or Uint8Array using query parameters.
Always append ?arraybuffer or ?uint8array to import paths to get binary data.
Convert require statements to import statements, or use Vite's CJS compatibility mode.
Update imports to include ?arraybuffer or ?uint8array query parameter.
Use query parameters on imports instead; they override the config-based output type.
For large files, consider using fetch() with streaming or a WebWorker to avoid blocking the main thread.
Run 'npm install vite-plugin-arraybuffer' and ensure the import is from 'vite-plugin-arraybuffer' (not './vite-plugin-arraybuffer').
Append '?arraybuffer' to the import path, e.g., import data from './file.bin?arraybuffer'.
Ensure your file is an ES module (use type: 'module' in package.json or .mjs extension) and run via Vite.
Use streaming or chunked loading for large files. Consider using the Web Streams API instead of direct import.
No dependency data recorded yet.