Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More Utilities in Deno.* #28200

Closed
2 tasks
CyanChanges opened this issue Feb 20, 2025 · 3 comments
Closed
2 tasks

More Utilities in Deno.* #28200

CyanChanges opened this issue Feb 20, 2025 · 3 comments

Comments

@CyanChanges
Copy link
Contributor

CyanChanges commented Feb 20, 2025

We need more thing and improvements in Deno.*!

Progress Tracing

Simplify Deno.Command

To pass things into stdin you need to:

const command = new Deno.Command(Deno.execPath(), {
  args: [
    "run",
    "-",
  ],
  stdin: "piped"
});
const child = command.spawn();

child.stdin.write("console.log('hello')")
child.stdin.close();
const status = await child.status; // wait for exit

In most cases, you don't need to precise control when to write something,
Inspired by Bun, if you can just put something like Response to the stdin option,
and it automatically do the thing for you.

const command = new Deno.Command(Deno.execPath(), {
  args: [
    "run",
    "-",
  ],
  stdin: new Response("console.log('hello')")
});

const child = command.spawn();
const status = await child.status; // wait for exit

Deno.hash / Deno.password

In Node.js, we do hash like:

import { createHash } from 'node:crypto'

const hash = createHash('sha256')
  .update("pa$$word")
  .digest('hex')

node:crypto only have support for algorithm supported in openssl.
But in nowadays, we may use more likely to use argon2, yescrypt for hashing passwords,
but those isn't in node:crypto, if we can just

const hash = await Deno.password.hash("pa$$word", {
 algorithm: "argon2id",
 memory: 2,
 time: 2
})

and

const hash = await Deno.hash.sha256("whatever")

it will be more easier to use, and
implementation in native will also be faster.
(or maybe use wasm to avoid v8 internal binding costs)

@dsherret
Copy link
Member

Can you open separate issues for each request?

@CyanChanges
Copy link
Contributor Author

Can you open separate issues for each request?

Created as:
#28276
#28277

@dsherret
Copy link
Member

Let's track these there.

@dsherret dsherret closed this as not planned Won't fix, can't repro, duplicate, stale Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants