DenoDDeno
Powered by
MqxM
Deno•4mo ago•
23 replies
Mqx

Publish binaries to JSR and load them using Deno.dlopen()

🌍3rd Party Module🛰️FFI / Native Code📰JSRDeno.* APIs
Hey is it possible to publish binary files such as
.dll
.dll
or
.so
.so
files and then access them via Import in an other package?

I would like to publish binaries to JSR, for example like this:

deno.json
deno.json

{
  "name": "@mypackage/binaries",
  "version": "0.1.0",
  "exports": {
    "./bin.dll": "./path/to/bin.dll"
  }
}
{
  "name": "@mypackage/binaries",
  "version": "0.1.0",
  "exports": {
    "./bin.dll": "./path/to/bin.dll"
  }
}


So that I could then install the package and use the binary via an import, for example like this:

import bin from "@mypackage/binaries/bin.dll"

const lib = Deno.dlopen(bin, …);
import bin from "@mypackage/binaries/bin.dll"

const lib = Deno.dlopen(bin, …);


Is this somehow possible? I know there are 3rd party libraries like plug that do something like this, but I am just curious if I could get this to work without something like plug.
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,934Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

JSR Publish error
cameronmCcameronm / help
12mo ago
How to publish global types with JSR?
rezi99Rrezi99 / help
2y ago
Deno.dlopen does not support flags
TheoryInMotionTTheoryInMotion / help
14mo ago
[SOLVED] Unable to publish to JSR via gh action
cleoCcleo / help
2y ago