Does the NodeJS OS module know which platform Yosemite or Windows8 came from?

I try to discover the natural look of the operating system, so I style my elements close to the OS feel (like Skeuomorph or Flat).

I am currently using the os' NodeJS module to get OS information. On Mac [Mavericks] I can get the value of "darwin" via os.platform()

which, according to the wiki, is also called Yosemite.

My main goal is to determine if the OS is using flat design (like the new Windows8 or Mac Yosemite) or the traditional skeuomorph design.

Is there a list of platform names for different OS? - OR alternatively - Is there an easier / better way to determine if the OS is using flat or skeuomorph designs?

+3


source to share


1 answer


Quote from here .

There is now a module os

: Node OS Module Documents . It has a function to get the platformos.platform

The docs do not provide return values. So, I have documented some of them below. Results for Ubuntu 12.04 64-bit, OS X 10.8.5, Windows 7 64-bit, and Joyent SmartMachine, respectively. Tests were done on Node 0.10.

Linux

  • os.type()

    : 'Linux'

  • os.platform()

    : 'Linux'

  • os.arch()

    : 'x64'

OS X (Mac)



  • os.type()

    : 'Darwin'

  • os.platform()

    : 'Darwin'

  • os.arch()

    : 'x64'

Window

  • os.type()

    : 'Windows_NT'

  • os.platform()

    : 'win32'

  • os.arch()

    : 'x64'

SmartMachine

  • os.type()

    : 'SunOS'

  • os.platform()

    : 'SunOS'

  • os.arch()

    : 'ia32'

Note. On Windows 7 64-bit Node may incorrectly report os.arch()

how ia32

. This is a documented bug: os.arch should be the OS architecture, not the process

+1


source







All Articles