NodeJs – How to get Windows ProgramData directory in NodeJs

I need to write some files into folder, that can be access any local user and can be modified by any user.
So I decided to use Windows ProgramData folder. I found following details from a article.

There’s also the ProgramData folder. This folder has most in common
with the Application Data folders, but—instead of having an individual
folder for each user—the ProgramData folder is shared among all the
user accounts on your PC.

On Windows XP, there was no C:ProgramData folder. Instead, there was
a “C:Documents and SettingsAll UsersApplication Data” folder.
Starting with Windows Vista, the All Users application data folder was
moved to C:ProgramData.

You can still see this today. If you plug C:UsersAll Users into
File Explorer or Windows Explorer on Windows 10, Windows will
automatically redirect you to the C:Program Data folder. It’ll
redirect any program that tries to write to C:UsersAll Users to the
C:ProgramData folder, too.

Is there any method to get Windows ProgramData directory in NodeJs, without hard coding like "C:ProgramData" or "C:UsersAll Users" ?

Source: Windows Questions

LEAVE A COMMENT