npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

win-permissions-js

v1.1.0

Published

Folder Permissions Manager, Wrapper for Win32 Native Permissions

Readme

WIN-PERMISSIONS-JS

Codacy Badge

Folder Permissions Manager, Wrapper for Win32 Permissions

Visual Studio Build Tools 2019

Manually: https://visualstudio.microsoft.com/fr/visual-cpp-build-tools/

Visual Studio Build Tools > 2017 are needed for win-permissions-js (C++ 17)!!!

$buildToolsUrl="https://aka.ms/vs/16/release/vs_buildtools.exe"
$buildToolsPath=Join-Path $base_install_path 'BuildTools'

# Big mistake here, we should use Microsoft.VisualStudio.Component.VC.Tools.x86.x64 and Microsoft.VisualStudio.Component.VC.v141.x86.x64
# instead of Microsoft.VisualStudio.Workload.AzureBuildTools

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest -Uri $buildToolsUrl -OutFile "vs_buildtools.exe"
Start-Process -Wait -NoNewWindow -FilePath .\vs_buildtools.exe -ArgumentList '--quiet', '--wait', '--norestart', '--nocache', $('--installPath {0}' -f $buildToolsPath),
    '--add Microsoft.VisualStudio.Component.VC.CoreBuildTools',
    '--add Microsoft.VisualStudio.Component.VC.Redist.14.Latest',
    '--add Microsoft.VisualStudio.Component.Windows10SDK',
    '--add Microsoft.VisualStudio.Component.TestTools.BuildTools',
    '--add Microsoft.VisualStudio.Component.VC.ASAN',
    '--add Microsoft.VisualStudio.Component.VC.CMake.Project',
    '--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64',
    '--add Microsoft.VisualStudio.Component.Windows10SDK.18362'

$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")
Build Tools (Visual Studio Build Tools 2017 + Python 2.7) for gyp

https://www.npmjs.com/package/windows-build-tools


npm config set proxy http://proxy.test.org:8080
npm config set https-proxy http://proxy.test.org:8080

npm install --global --production --add-python-to-path windows-build-tools

#Refreshing PATH Variable after build tools installation
$env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path","User")

Usage


import winPermissionsManager       from "win-permissions-js";

/**
 * Setting Access Rights on a Folder. This function is intended for
 * Windows Use only.
 * @param folderPath
 * @param rights
 * @returns {Promise<void>}
 */
export const setAccessRightsOnFolder =  ({folderPath, rights}) =>
    new Promise(resolve => {
        let currentPermissionsManager = new winPermissionsManager({folderPath});
        rights.forEach(right => {
            currentPermissionsManager.addRight(right);
        });
        currentPermissionsManager.applyRights({disableInheritance: true});
        resolve();
    });
//folderPath: current folder Path
let currentPermissionsManager = new winPermissionsManager({folderPath});

//domain: user or group domain
//name: user- or group- name
//accessString: Access Mask as String
//isUser: user or group account?
//propagate: Should propagate Rights or not (CI)(OI) vs. (NP)
currentPermissionsManager.addRight({domain, name, accessString, isUser, propagate});

//applying new Permissions (SET) on folder
//disabling Inheritance if desired with parameter disableInheritance:true
currentPermissionsManager.applyRights({disableInheritance:true});

//you should be careful with applyRights and disableInheritance:true! You could end up resetting the Folder Rights

Access Mask as comma separated String

Please Read: https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/icacls

/***
 * Initializing accessMask_
 */
FolderPermissionsManager::AccessMask FolderPermissionsManager::accessMask_ = {
        {L"D",0x00010000},
        {L"RC",0x00020000},
        {L"WDAC",0x00040000},
        {L"WO", 0x00080000},
        {L"S",0x00100000},
        {L"AS",0x01000000},
        {L"MA",0x02000000},
        {L"GR",0x80000000},
        {L"GW",0x40000000},
        {L"GE",0x20000000},
        {L"GA",0x10000000},
        {L"RD",0x00000001},
        {L"WD",0x00000002},
        {L"AD",0x00000004},
        {L"REA",0x00000008},
        {L"WEA",0x00000010},
        {L"X",0x00000020},
        {L"DC",0x00000040},
        {L"RA",0x00000080},
        {L"WA",0x00000100}
};

/*
 * const modify = "GE,GR,DC,AD,WD,WA,WEA,RA"; (modify without right to delete current folder, only sub folders)
 * const read = "GE,GR,RA"; 
 * const fullControl = "GA";
 */