Deno Import Stl Functions

1.0.0Last update Dec 1, 2024
by@lovelindhoni

This codemod updates removed Deno function calls in Deno v2 to their new equivalents from the standard library It also automatically adds the necessary import statements from the appropriate modules.

Before

function example() {
const buffer = new Deno.Buffer();
Deno.copy(source, destination);
}

After

import { Buffer } from "jsr:@std/io/buffer";
import { copy } from "jsr:@std/io/copy";
function example() {
const buffer = new Buffer();
copy(source, destination);
}

The following Deno functions are replaced:

  • Deno.BufferBuffer
  • Deno.copycopy
  • Deno.iteriterateReader
  • Deno.iterSynciterateReaderSync
  • Deno.writeAllSyncwriteAllSync
  • Deno.writeAllwriteAll
  • Deno.readAllSyncreadAllSync
  • Deno.readAllreadAll

Build custom codemods

Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community

background illustrationGet Started Now