Converts binary files to base64 string modules
import binaryBase64 from "./data.bin";
console.log(`data base64 string: ${binaryBase64}`);
npm i rollup-plugin-binary2base64 -D
import { rollup } from "rollup";
import { binary2base64 } from "rollup-plugin-binary2base64";
rollup({
entry: "main.js",
plugins: [
binary2base64({
// Required to be specified
include: ["**/*.wasm", "**/*.bin"]
// Undefined by default
exclude: ["**/exclude.bin"]
})
]
});
MIT © Izzy Chen