Skip to content
This repository was archived by the owner on Apr 22, 2023. It is now read-only.
This repository was archived by the owner on Apr 22, 2023. It is now read-only.

Update docs for os.platform() to enumerate the return values and conditions #25769

@tomprogers

Description

@tomprogers

The entry for os.arch() lists all the possible return values, and it's clear under what conditions each applies.

Please do the same thing for os.platform(). It's not convenient to execute an exploratory console.log(os.platform()) on each OS a developer wishes to support.

Perhaps something like this is appropriate (note: data invented for illustration purposes -- this list is a wild guess!):

OS return
Windows XP "win32"
Windows 7/8 32-bit "win32" [sic]
Windows 7/8 64-bit "win32" [sic]
MacOS "darwin"
Ubuntu, Gentoo, RedHat "linux"

Even a more general enumeration would be very helpful, if it's completely accurate (again, I don't know if any of the details are true):

All supported Windows versions (up to and including Windows 7 SP1) return "win32"; all supported MacOS versions (up to 10.10) return "darwin"; any identifiably *nix-like platform returns "linux"; anything not recognized returns null.

I think there is interest in this information. See e.g. this Stack Overflow question, and note how many upvotes comments have received for providing just one of the needed datapoints.

I think it's reasonable for the project to maintain documentation for these values, assuming the project also maintains the nodejs implementation of os.platform() on each of the platforms.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions