Skip to main content
Deno 2 is finally here πŸŽ‰οΈ
Learn more

Binaryify

If (for bundling purposes) you want to use an import statement for data that isn’t necessarily JavaScript, then this is the tool for you.

deno install -Af https://deno.land/x/binaryify@2.2.0.0/binaryify.js
# might need
export PATH="$HOME/.deno/bin:$PATH"

# usage
binaryify -- YOUR_FILE.wasm

# outputs:
#    // paths have been generated!
#    // add this wherever you need it now:
#    import { stringToBytes } from "https://deno.land/x/binaryify@2.2.0.0/tools.js"
#
#    import binaryStringForYourFile from "./YOUR_FILE.wasm.binaryified.js"
#    const uint8ArrayForYourFile = stringToBytes(binaryStringForYourFile)
import { binaryify } from "https://deno.land/x/binaryify@2.2.0.0/tools.js"
await binaryify({
    pathToBinary: "your_thing.png",
    pathToBinarified: "your_thing.binaryified.js",
})

Example Run