summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/os.ts
diff options
context:
space:
mode:
Diffstat (limited to 'ext/node/polyfills/os.ts')
-rw-r--r--ext/node/polyfills/os.ts12
1 files changed, 12 insertions, 0 deletions
diff --git a/ext/node/polyfills/os.ts b/ext/node/polyfills/os.ts
index 83e56e9f4..af3e69d64 100644
--- a/ext/node/polyfills/os.ts
+++ b/ext/node/polyfills/os.ts
@@ -129,6 +129,8 @@ export function arch(): string {
(type as any)[Symbol.toPrimitive] = (): string => type();
// deno-lint-ignore no-explicit-any
(uptime as any)[Symbol.toPrimitive] = (): number => uptime();
+// deno-lint-ignore no-explicit-any
+(machine as any)[Symbol.toPrimitive] = (): string => machine();
export function cpus(): CPUCoreInfo[] {
return ops.op_cpus();
@@ -247,6 +249,15 @@ export function version(): string {
return Deno.osRelease();
}
+/** Returns the machine type as a string */
+export function machine(): string {
+ if (Deno.build.arch == "aarch64") {
+ return "arm64";
+ }
+
+ return Deno.build.arch;
+}
+
/** Not yet implemented */
export function setPriority(pid: number, priority?: number) {
/* The node API has the 'pid' as the first parameter and as optional.
@@ -373,6 +384,7 @@ export default {
hostname,
loadavg,
networkInterfaces,
+ machine,
platform,
release,
setPriority,