import myModule from "./my-module.torrent": requiring Node modules from BitTorrent

1 · Evan Hahn · Jan. 13, 2024, midnight
Recent versions of Node.js added a feature called “Customization Hooks”. This lets you change the way modules load. In other words, you can control how import works. I wondered…could you import a JavaScript file from BitTorrent? Could you import a module from a .torrent file? Introducing torrent-import After a few days of work, I built torrent-import. It lets you import Node modules from .torrent files or magnet: URIs. Use it like this: import { greet } from "./greet.js.torrent"; console.log(gre...