Skip to main content
On this page

Deno 1.x to 2.x Migration Guide

This document contains guidance for migrating from Deno 1.x to 2.x, namely for subcommands, flags and symbols that have been removed or changed in Deno 2.

Work in progress

Deno 2.0 is under active development - these API changes and recommendations will continue to be updated until the launch of 2.0.

Updated subcommands Jump to heading

deno bundle Jump to heading

The deno bundle command has been removed. We recommend using esbuild together with esbuild-deno-loader.

import * as esbuild from "npm:esbuild";
import { denoPlugins } from "jsr:@luca/esbuild-deno-loader";

const result = await esbuild.build({
  plugins: [...denoPlugins()],
  entryPoints: ["https://deno.land/std@0.185.0/bytes/mod.ts"],
  outfile: "./dist/bytes.esm.js",
  bundle: true,
  format: "esm",
});

esbuild.stop();

deno cache Jump to heading

The deno cache command has been merged into the deno install command under the --entrypoint option.

- deno cache main.ts
+ deno install --entrypoint main.ts

deno vendor Jump to heading

The deno vendor command has been replaced by a "vendor": true configuration option in deno.json.

deno.json
{
  "vendor": true
}

Updated flags Jump to heading

--allow-none Jump to heading

Use the --permit-no-files CLI flag instead.

- deno test --allow-none
+ deno test --permit-no-files

--jobs Jump to heading

Use the DENO_JOBS environment variable instead.

- deno test --jobs=4 --parallel
+ DENO_JOBS=4 deno test --parallel

--ts Jump to heading

Use the --ext=ts CLI flag instead.

- deno run --ts script.ts
+ deno run --ext=ts script.ts
- deno run -T script.ts
+ deno run --ext=ts script.ts

--trace-ops Jump to heading

Use the --trace-leaks CLI flag instead.

- deno test --trace-ops
+ deno test --trace-leaks

---unstable Jump to heading

Use granular unstable flags (--unstable-*) or configuration options instead. See Unstable Feature Flags for reference.

// kv.ts
const kv = await Deno.openKv();

// ...
- deno run --unstable kv.ts
+ deno run --unstable-kv kv.ts

Or

{
+ "unstable": ["kv"]
}

See the Deno 1.40 Blog Post for details.

Updated symbols Jump to heading

Deno.Buffer Jump to heading

Use Buffer from the Standard Library instead.

+ import { Buffer } from "jsr:@std/io/buffer";

- const buffer = new Deno.Buffer();
+ const buffer = new Buffer();

  // ...

See deno#9795 for details.

Deno.Closer Jump to heading

Use Closer from the Standard Library instead.

+ import type { Closer } from "jsr:@std/io/types";

- function foo(closer: Deno.Closer) {
+ function foo(closer: Closer) {
  // ...  
}

See deno#9795 for details.

Deno.close() Jump to heading

Use the .close() method on the resource instead.

  const conn = await Deno.connect({ port: 80 });

  // ...

- Deno.close(conn.rid);
+ conn.close();
  const file = await Deno.open("/foo/bar.txt");

  // ...

- Deno.close(file.rid);
+ file.close();

See the Deno 1.40 blog post for details.

Deno.Conn.prototype.rid Jump to heading

Use Deno.Conn instance methods instead.

  const conn = await Deno.connect({ port: 80 });

  const buffer = new Uint8Array(1_024);
- await Deno.read(conn.rid, buffer);
+ await conn.read(buffer);

  const data = new TextEncoder().encode("Hello, world!");
- await Deno.write(conn.rid, data);
+ await conn.write(data);

- await Deno.shutdown(conn.rid);
+ await conn.closeWrite();

- Deno.close(conn.rid);
+ conn.close();

See the Deno 1.40 blog post for details.

Deno.ConnectTlsOptions.certChain Jump to heading

Use the cert option instead.

const caCert = await Deno.readTextFile("./certs/my_custom_root_CA.pem");
using conn = await Deno.connectTls({
  hostname: "192.0.2.1",
  port: 80,
  caCerts: [caCert],
- certChain: Deno.readTextFileSync("./server.crt"),
+ cert: Deno.readTextFileSync("./server.crt"),
  key: Deno.readTextFileSync("./server.key"),
});

See deno#22274 for details.

Deno.ConnectTlsOptions.certFile Jump to heading

Use the cert option instead.

const caCert = await Deno.readTextFile("./certs/my_custom_root_CA.pem");
using conn = await Deno.connectTls({
  hostname: "192.0.2.1",
  port: 80,
  caCerts: [caCert],
- certFile: "./server.crt",
+ cert: Deno.readTextFileSync("./server.crt"),
  key: Deno.readTextFileSync("./server.key"),
});

See deno#22274 for details.

Deno.ConnectTlsOptions.privateKey Jump to heading

Use the key option instead.

const caCert = await Deno.readTextFile("./certs/my_custom_root_CA.pem");
using conn = await Deno.connectTls({
  hostname: "192.0.2.1",
  port: 80,
  caCerts: [caCert],
  cert: Deno.readTextFileSync("./server.crt"),
- keyFile: "./server.key",
+ key: Deno.readTextFileSync("./server.key"),
});

See deno#22274 for details.

Deno.copy() Jump to heading

Use copy() from the Standard Library instead.

+ import { copy } from "jsr:@std/io/copy";

  using file = await Deno.open("/foo/bar.txt");

- await Deno.copy(file, Deno.stdout);
+ await copy(file, Deno.stdout);

See deno#9795 for details.

Deno.customInspect Jump to heading

Use Symbol.for("Deno.customInspect") instead.

class Foo {
- [Deno.customInspect]() {
+ [Symbol.for("Deno.customInspect")] {
  }
}

See deno#9294 for details.

Deno.fdatasync() Jump to heading

Use Deno.FsFile.prototype.syncData() instead.

  using file = await Deno.open("/foo/bar.txt", { read: true, write: true });

  await file.write(new TextEncoder().encode("Hello, world!"));
- await Deno.fdatasync(file.rid);
+ await file.syncData();

Deno.fdatasyncSync() Jump to heading

Use Deno.FsFile.prototype.syncDataSync() instead.

  using file = Deno.openSync("/foo/bar.txt", { read: true, write: true });

  file.writeSync(new TextEncoder().encode("Hello, world!"));
- Deno.fdatasyncSync(file.rid);
+ file.syncDataSync();

Deno.File Jump to heading

Use Deno.FsFile instead.

- function foo(file: Deno.File) {
+ function foo(file: Deno.FsFile) {
  // ...
}

See deno#13661 for details.

Deno.flock() Jump to heading

Use Deno.FsFile.prototype.lock() instead.

  using file = await Deno.open("/foo/bar.txt");

- await Deno.flock(file.rid);
+ await file.lock();

See deno#22178 for details.

Deno.flockSync() Jump to heading

Use Deno.FsFile.prototype.lockSync() instead.

  using file = Deno.openSync("/foo/bar.txt");

- Deno.flockSync(file.rid);
+ file.lockSync();

See deno#22178 for details.

Deno.FsFile.prototype.rid Jump to heading

Use Deno.FsFile instance methods instead.

  const file = await Deno.open("/foo/bar.txt");

  const buffer = new Uint8Array(1_024);
- await Deno.read(file.rid, buffer);
+ await file.read(buffer);

  const data = new TextEncoder().encode("Hello, world!");
- await Deno.write(file.rid, data);
+ await file.write(data);

- Deno.close(file.rid);
+ file.close();

Deno.fstatSync() Jump to heading

Use Deno.FsFile.prototype.statSync() instead.

  using file = Deno.openSync("/foo/bar.txt");

- const fileInfo = Deno.fstatSync(file.rid);
+ const fileInfo = file.statSync();

See the Deno 1.40 blog post for details.

Deno.fstat() Jump to heading

Use Deno.FsFile.prototype.stat() instead.

  using file = await Deno.open("/foo/bar.txt");

- const fileInfo = await Deno.fstat(file.rid);
+ const fileInfo = await file.stat();

See the Deno 1.40 blog post for details.

Deno.FsWatcher.prototype.rid Jump to heading

Use Deno.FsWatcher instance methods instead.

  using watcher = Deno.watchFs("/dir");

  // ...

- Deno.close(watcher.rid);
+ watcher.close();

See Deno 1.40 blog post for details.

Deno.fsync() Jump to heading

Use Deno.FsFile.prototype.sync() instead.

  using file = await Deno.open("/foo/bar.txt", { read: true, write: true });

  await file.write(new TextEncoder().encode("Hello, world!"));
  await file.truncate(1);
- await Deno.fsync(file.rid);
+ await file.sync();

Deno.fsyncSync() Jump to heading

Use Deno.FsFile.prototype.syncSync() instead.

  using file = Deno.openSync("/foo/bar.txt", { read: true, write: true });

  file.writeSync("new TextEncoder().encode("Hello, world!"));
  file.truncateSync(1);
- Deno.fsyncSync(file.rid);
+ file.syncSync();

Deno.ftruncateSync() Jump to heading

Use Deno.FsFile.prototype.truncateSync() instead.

  using file = Deno.openSync("/foo/bar.txt");

- Deno.ftruncateSync(file.rid, 7);
+ file.truncateSync(7);

See the Deno 1.40 blog post for details.

Deno.ftruncate() Jump to heading

Use Deno.FsFile.prototype.truncate() instead.

  using file = await Deno.open("/foo/bar.txt");

- await Deno.ftruncate(file.rid, 7);
+ await file.truncate(7);

See the Deno 1.40 blog post for details.

Deno.funlock() Jump to heading

Use Deno.FsFile.prototype.unlock() instead.

  using file = await Deno.open("/foo/bar.txt");

- await Deno.funlock(file.rid);
+ await file.unlock();

See deno#22178 for details.

Deno.funlockSync() Jump to heading

Use Deno.FsFile.prototype.unlockSync() instead.

  using file = Deno.openSync("/foo/bar.txt");

- Deno.funlockSync(file.rid);
+ file.unlockSync();

See deno#22178 for details.

Deno.futimeSync() Jump to heading

Use Deno.FsFile.prototype.utimeSync() instead.

  using file = Deno.openSync("/foo/bar.txt");

- Deno.futimeSync(file.rid, 1556495550, new Date());
+ file.utimeSync(1556495550, new Date());

See the Deno 1.40 blog post for details.

Deno.futime() Jump to heading

Use Deno.FsFile.prototype.utime() instead.

  using file = await Deno.open("/foo/bar.txt");

- await Deno.futime(file.rid, 1556495550, new Date());
+ await file.utime(1556495550, new Date());

See the Deno 1.40 blog post for details.

Deno.isatty() Jump to heading

Use Deno.FsFile.prototype.isTerminal(), Deno.stdin.prototype.isTerminal(), Deno.stdout.prototype.isTerminal() or Deno.stderr.prototype.isTerminal() instead.

  using file = await Deno.open("/dev/tty6");

- Deno.isatty(file.rid);
+ file.isTerminal();
- Deno.isatty(Deno.stdin.rid);
+ Deno.stdin.isTerminal();
- Deno.isatty(Deno.stdout.rid);
+ Deno.stdout.isTerminal();
- Deno.isatty(Deno.stderr.rid);
+ Deno.stderr.isTerminal();

See the Deno 1.40 blog post for details.

Deno.iter() Jump to heading

Use iterateReader() from the Standard Library instead.

+ import { iterateReader } from "jsr:@std/io/iterate-reader";

- for await (const chunk of Deno.iter(Deno.stdout)) {
+ for await (const chunk of iterateReader(Deno.stdout)) {
  // ...
}
+ import { iterateReaderSync } from "jsr:@std/io/iterate-reader";

  using file = await Deno.open("/foo/bar.txt");

- for await (const chunk of Deno.iter(file)) {
+ for await (const chunk of iterateReader(file)) {
  // ...
}

See deno#9795 for details.

Deno.iterSync() Jump to heading

Use iterateReaderSync() from the Standard Library instead.

+ import { iterateReaderSync } from "jsr:@std/io/iterate-reader";

- for (const chunk of Deno.iterSync(Deno.stdout)) {
+ for (const chunk of iterateReaderSync(Deno.stdout)) {
  // ...
}
+ import { iterateReaderSync } from "jsr:@std/io/iterate-reader";

  using file = await Deno.open("/foo/bar.txt");

- for (const chunk of Deno.iterSync(file)) {
+ for (const chunk of iterateReaderSync(file)) {
  // ...
}

See deno#9795 for details.

Deno.Listener.prototype.rid Jump to heading

Use Deno.Listener instance methods instead.

  const listener = Deno.listen({ port: 80 })

- Deno.close(listener.rid);
+ listener.close();

See the Deno 1.40 blog post for details.

Deno.ListenTlsOptions.certChain Jump to heading

Use the cert option instead.

using listener = Deno.listenTls({
  port: 443,
- certChain: Deno.readTextFile("./server.crt"),
+ cert: Deno.readTextFile("./server.crt"),
  key: Deno.readTextFileSync("./server.key"),
});

Deno.ListenTlsOptions.certFile Jump to heading

Pass the certificate file contents to the cert option instead.

using listener = Deno.listenTls({
  port: 443,
- certFile: "./server.crt",
+ cert: Deno.readTextFile("./server.crt"),
  key: Deno.readTextFileSync("./server.key"),
});

See deno#12639 for details.

Deno.ListenTlsOptions.keyFile Jump to heading

Pass the key file contents to the key option instead.

using listener = Deno.listenTls({
  port: 443,
  cert: Deno.readTextFile("./server.crt"),
- keyFile: "./server.key",
+ key: Deno.readTextFileSync("./server.key"),
});

See deno#12639 for details.

Deno.metrics() Jump to heading

There is no replacement API for this symbol.

Deno.readAllSync() Jump to heading

Use readAllSync() from the Standard Library instead.

+ import { readAllSync } from "jsr:@std/io/read-all";

- const data = Deno.readAllSync(Deno.stdin);
+ const data = readAllSync(Deno.stdin);
+ import { readAllSync } from "jsr:@std/io/read-all";

  using file = Deno.openSync("/foo/bar.txt", { read: true });

- const data = Deno.readAllSync(file);
+ const data = readAllSync(file);

See deno#9795 for details.

Deno.readAll() Jump to heading

Use readAll() from the Standard Library instead.

+ import { readAll } from "jsr:@std/io/read-all";

- const data = await Deno.readAll(Deno.stdin);
+ const data = await readAll(Deno.stdin);
+ import { readAll } from "jsr:@std/io/read-all";

  using file = await Deno.open("/foo/bar.txt", { read: true });

- const data = await Deno.readAll(file);
+ const data = await readAll(file);

See deno#9795 for details.

Deno.Reader Jump to heading

Use Reader from the Standard Library instead.

+ import type { Reader } from "jsr:@std/io/types";

- function foo(closer: Deno.Reader) {
+ function foo(closer: Reader) {
  // ...  
}

See deno#9795 for details.

Deno.ReaderSync Jump to heading

Use ReaderSync from the Standard Library instead.

+ import type { ReaderSync } from "jsr:@std/io/types";

- function foo(reader: Deno.ReaderSync) {
+ function foo(reader: ReaderSync) {
  // ...  
}

See deno#9795 for details.

Deno.readSync() Jump to heading

Use the .readSync() method on the resource itself.

  using conn = await Deno.connect({ port: 80 });
  const buffer = new Uint8Array(1_024);

- Deno.readSync(conn.rid, buffer);
+ conn.readSync(buffer);
  using file = Deno.openSync("/foo/bar.txt");
  const buffer = new Uint8Array(1_024);

- Deno.readSync(file.rid, buffer);
+ file.readSync(buffer);

See deno#9795 for details.

Deno.read() Jump to heading

Use the .read() method on the resource itself.

  using conn = await Deno.connect({ port: 80 });
  const buffer = new Uint8Array(1_024);

- await Deno.read(conn.rid, buffer);
+ await conn.read(buffer);
  using file = await Deno.open("/foo/bar.txt");
  const buffer = new Uint8Array(1_024);

- await Deno.read(file.rid, buffer);
+ await file.read(buffer);

See deno#9795 for details.

Deno.resources() Jump to heading

There is no replacement API for this symbol, as resource IDs (RIDs) are being phased-out.

Deno.run() Jump to heading

Use new Deno.Command() instead.

- const process = Deno.run({ cmd: [ "echo", "hello world" ], stdout: "piped" });
- const [{ success }, stdout] = await Promise.all([
-   process.status(),
-   process.output(),
- ]);
- process.close();
+ const command = new Deno.Command("echo", {
+   args: ["hello world"]
+ });
+ const { success, stdout } = await command.output();
  console.log(success);
  console.log(new TextDecoder().decode(stdout));

Note: This symbol is soft-removed as of Deno 2. Its types have been removed but its implementation remains in order to reduce breaking changes. You can ignore "property does not exist" TypeScript errors by using the @ts-ignore directive.

+ // @ts-ignore `Deno.run()` is soft-removed as of Deno 2.
  const process = Deno.run({ cmd: [ "echo", "hello world" ], stdout: "piped" });
  const [{ success }, stdout] = await Promise.all([
    process.status(),
    process.output(),
  ]);
  process.close();
  console.log(success);
  console.log(new TextDecoder().decode(stdout));

See deno#16516 for details.

Deno.Seeker Jump to heading

Use Seeker from the Standard Library instead.

+ import type { Seeker } from "jsr:@std/io/types";

- function foo(seeker: Deno.Seeker) {
+ function foo(seeker: Seeker) {
  // ...  
}

Deno.SeekerSync Jump to heading

Use SeekerSync from the Standard Library instead.

+ import type { SeekerSync } from "jsr:@std/io/types";

- function foo(seeker: Deno.SeekerSync) {
+ function foo(seeker: SeekerSync) {
  // ...  
}

Deno.seekSync() Jump to heading

Use Deno.FsFile.prototype.seekSync() instead.

  using file = await Deno.open("/foo/bar.txt");

- Deno.seekSync(file.rid, 6, Deno.SeekMode.Start);
+ file.seekSync(6, Deno.SeekMode.Start);

See Deno 1.40 blog post for details.

Deno.seek() Jump to heading

Use Deno.FsFile.prototype.seek() instead.

  using file = await Deno.open("/foo/bar.txt");

- await Deno.seek(file.rid, 6, Deno.SeekMode.Start);
+ await file.seek(6, Deno.SeekMode.Start);

See Deno 1.40 blog post for details.

Deno.serveHttp() Jump to heading

Use Deno.serve() instead.

- const conn = Deno.listen({ port: 80 });
- const httpConn = Deno.serveHttp(await conn.accept());
- const e = await httpConn.nextRequest();
- if (e) {
-  e.respondWith(new Response("Hello World"));
- }
+ Deno.serve({ port: 80 }, () => new Response("Hello World"));

Note: This symbol is soft-removed as of Deno 2. Its types have been removed but its implementation remains in order to reduce breaking changes. You can ignore "property does not exist" TypeScript errors by using the @ts-ignore directive.

  const conn = Deno.listen({ port: 80 });
+ // @ts-ignore `Deno.serveHttp()` is soft-removed as of Deno 2.
  const httpConn = Deno.serveHttp(await conn.accept());
  const e = await httpConn.nextRequest();
  if (e) {
   e.respondWith(new Response("Hello World"));
  }

See the Deno 1.35 blog post for details.

Deno.Server Jump to heading

Use Deno.HttpServer instead.

- function foo(server: Deno.Server) {
+ function foo(server: Deno.HttpServer) {
  // ...  
}

See deno#20840 for details.

Deno.shutdown() Jump to heading

Use Deno.Conn.closeWrite() instead.

  using conn = await Deno.connect({ port: 80 });

- await Deno.shutdown(conn.rid);
+ await conn.closeWrite();

See Deno 1.40 blog post for details.

Deno.stderr.prototype.rid Jump to heading

Use Deno.stderr instance methods instead.

- if (Deno.isatty(Deno.stderr.rid)) {
+ if (Deno.stderr.isTerminal()) {
    console.log("`Deno.stderr` is a terminal");
  }

  const data = new TextEncoder().encode("Hello, world!");
- await Deno.write(Deno.stderr.rid, data);
+ await Deno.stderr.write(data);

- Deno.close(Deno.stderr.rid);
+ Deno.stderr.close();

Note: This symbol is soft-removed as of Deno 2. Its types have been removed but its implementation remains in order to reduce breaking changes. You can ignore "property does not exist" TypeScript errors by using the @ts-ignore directive.

+ // @ts-ignore `Deno.stderr.rid` is soft-removed as of Deno 2.
  Deno.isatty(Deno.stderr.rid);

See Deno 1.40 blog post for details.

Deno.stdin.prototype.rid Jump to heading

Use Deno.stdin instance methods instead.

- if (Deno.isatty(Deno.stdin.rid)) {
+ if (Deno.stdin.isTerminal()) {
    console.log("`Deno.stdout` is a terminal");
  }

  const buffer = new Uint8Array(1_024);
- await Deno.write(Deno.stdin.rid, buffer);
+ await Deno.stdin.write(buffer);

- Deno.close(Deno.stdin.rid);
+ Deno.stdin.close();

Note: This symbol is soft-removed as of Deno 2. Its types have been removed but its implementation remains in order to reduce breaking changes. You can ignore "property does not exist" TypeScript errors by using the @ts-ignore directive.

+ // @ts-ignore `Deno.stdin.rid` is soft-removed as of Deno 2.
  Deno.isatty(Deno.stdin.rid);

See Deno 1.40 blog post for details.

Deno.stdout.prototype.rid Jump to heading

Use Deno.stdout instance methods instead.

- if (Deno.isatty(Deno.stdout.rid)) {
+ if (Deno.stdout.isTerminal()) {
    console.log("`Deno.stdout` is a terminal");
  }

  const data = new TextEncoder().encode("Hello, world!");
- await Deno.write(Deno.stdout.rid, data);
+ await Deno.stdout.write(data);

- Deno.close(Deno.stdout.rid);
+ Deno.stdout.close();

Note: This symbol is soft-removed as of Deno 2. Its types have been removed but its implementation remains in order to reduce breaking changes. You can ignore "property does not exist" TypeScript errors by using the @ts-ignore directive.

+ // @ts-ignore `Deno.stdout.rid` is soft-removed as of Deno 2.
  Deno.isatty(Deno.stdout.rid);

See Deno 1.40 blog post for details.

Deno.TcpConn.prototype.rid Jump to heading

Use Deno.TcpConn instance methods instead.

  using tcpConn = await Deno.connect({ port: 80 });

  const buffer = new Uint8Array(1_024);
- await Deno.read(tcpConn.rid, buffer);
+ await tcpConn.read(buffer);

  const data = new TextEncoder().encode("Hello, world!");
- await Deno.write(tcpConn.rid, data);
+ await tcpConn.write(data);

- await Deno.shutdown(tcpConn.rid);
+ await tcpConn.closeWrite();

- Deno.close(tcpConn.rid);
+ tcpConn.close();

See the Deno 1.40 blog post for details.

Deno.TlsConn.prototype.rid Jump to heading

Use Deno.TlsConn instance methods instead.

  const caCert = await Deno.readTextFile("./certs/my_custom_root_CA.pem");
  using tlsConn = await Deno.connectTls({ caCerts: [caCert], hostname: "192.0.2.1", port: 80 });

  const buffer = new Uint8Array(1_024);
- await Deno.read(tlsConn.rid, buffer);
+ await tlsConn.read(buffer);

  const data = new TextEncoder().encode("Hello, world!");
- await Deno.write(tlsConn.rid, data);
+ await tlsConn.write(data);

- await Deno.shutdown(tlsConn.rid);
+ await tlsConn.closeWrite();

- Deno.close(tlsConn.rid);
+ tlsConn.close();

See the Deno 1.40 blog post for details.

Deno.TlsListener.prototype.rid Jump to heading

Use Deno.TlsListener instance methods instead.

  const listener = Deno.listenTls({
    port: 443,
    cert: Deno.readTextFileSync("./server.crt"),
    key: Deno.readTextFileSync("./server.key"),
  });

  // ...

- Deno.close(listener.rid);
+ listener.close();

See the Deno 1.40 blog post for details.

Deno.UnixConn.prototype.rid Jump to heading

Use Deno.UnixConn instance methods instead.

  using unixConn = await Deno.connect({ path: "/foo/bar.sock", transport: "unix" });

  const buffer = new Uint8Array(1_024);
- await Deno.read(unixConn.rid, buffer);
+ await unixConn.read(buffer);

  const data = new TextEncoder().encode("Hello, world!");
- await Deno.write(unixConn.rid, data);
+ await unixConn.write(data);

- await Deno.shutdown(unixConn.rid);
+ await unixConn.closeWrite();

- Deno.close(unixConn.rid);
+ unixConn.close();

See the Deno 1.40 blog post for details.

Deno.writeAllSync() Jump to heading

Use writeAllSync() from the Standard Library instead.

+ import { writeAllSync } from "jsr:@std/io/write-all";

  const data = new TextEncoder().encode("Hello, world!");

- Deno.writeAllSync(Deno.stdout, data);
+ writeAllSync(Deno.stdout, data);

See deno#9795 for details.

Deno.writeAll() Jump to heading

Use writeAll() from the Standard Library instead.

+ import { writeAll } from "jsr:@std/io/write-all";

  const data = new TextEncoder().encode("Hello, world!");

- await Deno.writeAll(Deno.stdout, data);
+ await writeAll(Deno.stdout, data);

See deno#9795 for details.

Deno.Writer Jump to heading

Use Writer from the Standard Library instead.

+ import type { Writer } from "jsr:@std/io/types";

- function foo(writer: Deno.Writer) {
+ function foo(writer: Writer) {
  // ...  
}

See deno#9795 for details.

Deno.WriterSync Jump to heading

Use WriterSync from the Standard Library instead.

+ import type { WriterSync } from "jsr:@std/io/types";

- function foo(writer: Deno.WriterSync) {
+ function foo(writer: WriterSync) {
  // ...  
}

See deno#9795 for details.

Deno.writeSync() Jump to heading

Use the .writeSync() method on the resource itself.

  using conn = await Deno.connect({ port: 80 });
  const buffer = new TextEncoder().encode("My message");

- Deno.writeSync(conn.rid, buffer);
+ conn.writeSync(buffer);
  using file = Deno.openSync("/foo/bar.txt", { write: true });
  const buffer = new TextEncoder().encode("My message");

- Deno.writeSync(file.rid, buffer);
+ file.writeSync(buffer);

See deno#9795 for details.

Deno.write() Jump to heading

Use the .write() method on the resource itself.

  using conn = await Deno.connect({ port: 80 });
  const buffer = new TextEncoder().encode("My message");

- await Deno.write(conn.rid, buffer);
+ await conn.write(buffer);
  using file = await Deno.open("/foo/bar.txt", { write: true });
  const buffer = new TextEncoder().encode("My message");

- await Deno.write(file.rid, buffer);
+ await file.write(buffer);

See deno#9795 for details.

new Deno.FsFile() Jump to heading

Use Deno.openSync() or Deno.open() instead.

- const file = new Deno.FsFile(3);
+ using file = await Deno.open("/foo/bar.txt");

window Jump to heading

Use globalThis instead.

  const messageBuffer = new TextEncoder().encode("Hello, world!");
  
- const hashBuffer = await window.crypto.subtle.digest("SHA-256", messageBuffer);
+ const hashBuffer = await globalThis.crypto.subtle.digest("SHA-256", messageBuffer);

See deno#9795 for details.