Deno 1.19 extends web streams support

Latest update to the secure runtime for JavaScript and TypeScript brings native support for web streams to files, network sockets, and stdio.

Deno 1.19 extends web streams support
Aleksei Derin / Getty Images

Deno 1.19, the latest version of the secure runtime for JavaScript and TypeScript, extends web stream support and introduces a deno vendor subcommand for “vendoring” dependencies.

In Deno 1.19, unveiled February 17, files, network sockets, and stdio now are native web streams. With this feature, the Deno.FsFile and Deno.Conn interfaces have readable and writable properties of type ReadableStream and WritableStream respectively. This allows them to integrate nicely with other web APIs that use web streams, according to release notes.

With all Deno APIs now supporting web streams out of the box, including the native HTTP server, composing APIs together is now simple, Deno’s developers said. Also being added in release 1.19 are new built-in transformers, CompressionStream and DeCompressionStream. This web standard API lets developers compress and decompress data in multiple file formats, currently gzip and deflate. The API already is in Chrome and will soon be in other browsers, release notes said.

For developers who would like to vendor their Deno application’s dependencies in their code repositories, the deno vendor subcommand can be invoked with one or more entry points to modules to be vendored. Deno then will build a module graph from these files by analyzing imports and exports of the modules. The resulting list of modules then is written to the vendor/ folder with names that resemble original module names as much as possible. The deno vendor subcommand was the result of feedback that users want to group specific program dependencies in their code repositories. Vendoring can be used to make sure that only some very specific code is executed by an application.

Developers can upgrade to Deno 1.19 by running deno upgrade. Methods for installing Deno for the first time can be found in the release notes. Other new features and improvements in Deno 1.19:

  • The Deno HTTP server API now supports connections established over Unix sockets in addition to TCP. This API currently is unstable.
  • Signal listener APIs have been stabilized.
  • deno compile now works more reliably, with the ES module graph serialized into the produced binary “as is” without bundling. This addresses a previous situation in which JavaScript programs would be bundled into a single ES module during compilation but the code sometimes would not behave the same as prior to bundling.
  • Deno.File, Deno’s abstraction for file system files, has been renamed Deno.FsFile to clear up confusion that resulted because of the File web API available in browsers and Deno.
  • Deno has been upgraded to the Google V8 9.9 JavaScript/WebAssembly engine.

Deno 1.19 follows the Deno 1.18 release in January.

Copyright © 2022 IDG Communications, Inc.

InfoWorld Technology of the Year Awards 2023. Now open for entries!