D
Deno

help

Deno equivalent os.cpus().length

Eeric.uhd10/18/2023
What’s the Deno Equivalent for os.cpus().length?
Mmarkthree10/18/2023
No built-in api, but compatible with node you can try it in deno 👇
import os from "node:os";

console.log(os.cpus().length);
import os from "node:os";

console.log(os.cpus().length);
Eeric.uhd10/18/2023
That’s strange that there’s no Deno native implementation but the Node compatibility layer is already there 🤔
Mmarkthree10/18/2023
Yes, I also think this is the missing part of the deno native api
AAapoAlas10/18/2023
Navigator: hardwareConcurrency property - Web APIs | MDN
The navigator.hardwareConcurrency read-only property returns the number of logical processors available to run threads on the user's computer.
Mmarkthree10/18/2023
I've raised an issue for all to discuss https://github.com/denoland/deno/issues/20933
GitHub
deno native os api enhancements · Issue #20933 · denoland/deno
Ref context: https://discord.com/channels/684898665143206084/1164090264852369458 deno native os api seems to be missing a lot of node compatibility layers for example 👇 import os from "node:os...
AAapoAlas10/18/2023
Since the standard hardware concurrency API exists I don't think a custom alternative would serve any purpose.

Looking for more? Join the community!

Recommended Posts
How can I get deno to access internal packages from a workspace in npm or bun?I have the following workspace setup. I would like to have a deno/oak/kv project in the same folderHow to resolve requires without `.js` extension in a very basic NPM resolver?I have an NPM resolver that without caching that expects everything to be in a `node_modules` folderHow do I have a subrouter in Oak?I want to use a subrouter in oak to handle part of the routing, how would I do that in Oak? here is rust ffi buffer overflowhi, do i have to null-terminate array when using rust ffi? i'm getting buffer overflows. ```rs #[no_How to actually sign out using deno_kv_authNot sure if bug or feature, but I have problems signing out from deno_kv_auth. I'm using Auth0 for tDistroless Docker image fails with `libc.so: cannot open shared object file: No such file`I am building a 1:1 with a Node project using the same base for a docker image `distroless/cc`. BothBootstrapping a minimal node-compatible runtimeI'm trying to bootstrap a minimal node-compatible runtime, so I've basically been copying and pastinI want to adjust around tls using fetch APIWith nodejs, you could specify a cipher suite or version to be used with tls. Can't you do the same RUN deno task in DockerfileI have made a script to make DB migrations happen using "deno task migration", and I'd love for it tHelp Web.jsrq need help in web.js \ ```js window.paypal .Buttons({ style: { shape: "rect", laUnable to load env variables in localI'm starting again with deno since a long time with a small telegram bot using the `grammy` frameworWhy Bad resource ID occurs?I ran the following and got `error: BadResource: Bad resource ID` on seek. ```typescript import { toStorybook: some lightweight alternative for Deno?Do you know some lightweight alternative for [Storybook](https://storybook.js.org) to run on Deno?How can i change the location of Cache.open('somedb')We're deploying to docker containers which needs to write to an attached volume (specific path)