Bairdy
Bairdy17mo ago

Remove std/node, it was merged into Deno itself (#3206)

This used to work, but now it doesn't. Where do you show examples of where this was moved to and how to use it from now on?
import { inflate } from "https://deno.land/std/node/zlib.ts";
import { Buffer } from "https://deno.land/std/node/buffer.ts";

const input = "789cb3b1d10fa92c48d5f72bcd4d4a2d72cb2fca4d2cd10fd5482e55482bd1d4775630d477016237178592a2d254fde0600d4d3b3b00bae60fb4";
const buffer = Buffer.from(input, "hex");

inflate(buffer, (err, result) => {
if (err) {
console.error(err);
return;
}
console.log(result.toString());
});
import { inflate } from "https://deno.land/std/node/zlib.ts";
import { Buffer } from "https://deno.land/std/node/buffer.ts";

const input = "789cb3b1d10fa92c48d5f72bcd4d4a2d72cb2fca4d2cd10fd5482e55482bd1d4775630d477016237178592a2d254fde0600d4d3b3b00bae60fb4";
const buffer = Buffer.from(input, "hex");

inflate(buffer, (err, result) => {
if (err) {
console.error(err);
return;
}
console.log(result.toString());
});
12 Replies
Unknown User
Unknown User17mo ago
Message Not Public
Sign In & Join Server To View
Bairdy
Bairdy17mo ago
So currently, deno does not have a way to do this without node correct?
Unknown User
Unknown User17mo ago
Message Not Public
Sign In & Join Server To View
Bairdy
Bairdy17mo ago
I mean, does deno do this directly but also offers a node way to do it? Or only the node way?
Unknown User
Unknown User17mo ago
Message Not Public
Sign In & Join Server To View
Bairdy
Bairdy17mo ago
I am referring to these. Does deno have these built in import { inflate } from "node:zlib"; import { Buffer } from "node:buffer"; Can I find them in API reference? That what I'm asking
javi
javi17mo ago
KyleJune
KyleJune17mo ago
You could still import the old std/node if you pin an older version of std. Although the node specifiers will probably work better than std/node in the future. Change std/node to std@0.177.0/node in your import urls if you want to keep using it from std instead of using the node specifiers.
Bairdy
Bairdy17mo ago
Ok. I don't like NODE. I will never use if I don't have to. Now that you know this, can you answer me if deno has these 2 libraries as pure deno code. not polyfil node code Hope I made sense this time No node. Imagine node doesn't exist right now and answer my question
KyleJune
KyleJune17mo ago
Yes, Deno doesn't depend on node. Deno had a polyfil for node in std but they moved that polyfil to core so that they could make it more efficient. The latest blog post has more details. But yes, Deno doesn't use node and you don't need to use Deno's polyfils for node. They exist to make it possible to use npm modules within deno projects and to make it easier to migrate existing node projects over to using deno instead. Having most npm modules available to deno developers will help improve adoption of deno since it will make it easier for people to use popular npm packages like React in Deno. And hopefully the node polyfils/package.json support will lead to more people leaving node for the deno ecosystem instead of people just using deno for new projects. So in my opinion, node and npm specifiers will improve the deno ecosystem and help bring more people into it.
Bairdy
Bairdy17mo ago
Thank you!