On this page
Interoperability with Node.js
Video descriptionJump to heading
Deno gained lots of interpoperability capabilities at its v2.0 release. In thisvideo, we'll look at how to use Node.js built-in APIs, NPM modules, and JSRpackages.
Transcript and examplesJump to heading
Deno 2.0 is here, and it's good. One of the mostamazing features of Deno is its interoperability with other platforms includingNode. For example, we can use the core Node.js built in APIs. All we have to dois add this Node specifier here.
import fsfrom"node:fs/promises";Deno also supports the use of NPM modules. All you need to do is add the NPMspecifier with your import and you're good to go.
import{*}as Sentryfrom"npm:@sentry/node";We can also take advantage ofJSR, an open source packageregistry for TypeScript and JavaScript.
import OpenAIfrom"jsr:@openai/openai";JSR works with Deno, of course, but also with Node.js. bun, and CloudFlareworkers. You can even install JSR packages into Vite and Next.js applications.
Deno also gives usimport maps,which help us manage our dependencies. You can install a package from JSR. Theimport will be added to thedeno.json, and you can even use a shorthand todescribe this to clean up your code even more. Deno 2.0 is focused on a reallysolid developer experience. New projects and migrations feel a whole lot easierwith Deno.