
Company News
/Security News
Socket Selected for OpenAI's Cybersecurity Grant Program
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.
vite-plugin-binary
Advanced tools
A Vite plugin for importing the file as binary with compress support.
npm i -D vite-plugin-binary
vite.config.ts
import { defineConfig } from 'vite'
import Binary from 'vite-plugin-binary'
export default defineConfig({
plugins: [Binary()],
})
// main.ts
import compressed from './opposans.ttf?binary'
Given the imports is compressed in gzip format. You can decompress by using the zlib no Node.js environment.
import { gunzipSync } from 'node:zlib'
import compressed from './opposans.ttf?binary'
const uint8Array = gzipSync(compressed)
Given the imports is compressed in gzip format. You can install fflate and other tools.
npm i fflate
import { gunzipSync } from 'fflate'
import compressed from './opposans.ttf?binary'
const uint8Array = gzipSync(compressed)
To add the types check support for using typescript. Modify the tsconfig.json file as follows.
{
"compilerOptions": {
"types": ["vite-plugin-binary/types"]
}
}
FAQs
Vite plugin for importing file in Uint8Array format
We found that vite-plugin-binary demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.