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 🙏

© 2024 – Pkg Stats / Ryan Hefner

@napi-rs/nice

v1.0.1

Published

https://linux.die.net/man/2/nice binding for Node.js

Downloads

3,127,297

Readme

@napi-rs/nice

https://github.com/Brooooooklyn/nice/actions install size Downloads

🚀 Help me to become a full-time open-source developer by sponsoring me on Github

https://linux.die.net/man/2/nice binding for Node.js

Usage

Install this test package

pnpm add @napi-rs/nice

or

yarn add @napi-rs/nice

or

npm install @napi-rs/nice

nice

On Unix, nice() adds inc to the nice value for the calling process. (A higher nice value means a low priority.) Only the superuser may specify a negative increment, or priority increase. The range for nice values is described in getpriority(2).

On Windows, it uses the SetThreadPriority function.

// on Unix
import { nice } from '@napi-rs/nice'

nice(2)
// on Windows
import { nice, WindowsThreadPriority } from '@napi-rs/nice'

nice(WindowsThreadPriority.THREAD_PRIORITY_ABOVE_NORMAL)

getCurrentProcessPriority

This function gets the priority of the current process. On Unix, it uses the getpriority(2).

On Windows, it uses the GetThreadPriority function.

| Priority Constant | Value | Description | | ----------------------------- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | THREAD_MODE_BACKGROUND_BEGIN | 0x00010000 | Begin background processing mode. The system lowers the resource scheduling priorities of the thread so that it can perform background work without significantly affecting activity in the foreground. | | | | This value can be specified only if hThread is a handle to the current thread. The function fails if the thread is already in background processing mode. | | | | Windows Server 2003: This value is not supported. | | THREAD_MODE_BACKGROUND_END | 0x00020000 | End background processing mode. The system restores the resource scheduling priorities of the thread as they were before the thread entered background processing mode. | | | | This value can be specified only if hThread is a handle to the current thread. The function fails if the thread is not in background processing mode. | | | | Windows Server 2003: This value is not supported. | | THREAD_PRIORITY_ABOVE_NORMAL | 1 | Priority 1 point above the priority class. | | THREAD_PRIORITY_BELOW_NORMAL | -1 | Priority 1 point below the priority class. | | THREAD_PRIORITY_HIGHEST | 2 | Priority 2 points above the priority class. | | THREAD_PRIORITY_IDLE | -15 | Base priority of 1 for IDLE_PRIORITY_CLASS, BELOW_NORMAL_PRIORITY_CLASS, NORMAL_PRIORITY_CLASS, ABOVE_NORMAL_PRIORITY_CLASS, or HIGH_PRIORITY_CLASS processes, and a base priority of 16 for REALTIME_PRIORITY_CLASS processes. | | THREAD_PRIORITY_LOWEST | -2 | Priority 2 points below the priority class. | | THREAD_PRIORITY_NORMAL | 0 | Normal priority for the priority class. | | THREAD_PRIORITY_TIME_CRITICAL | 15 | Base priority of 15 for IDLE_PRIORITY_CLASS, BELOW_NORMAL_PRIORITY_CLASS, NORMAL_PRIORITY_CLASS, ABOVE_NORMAL_PRIORITY_CLASS, or HIGH_PRIORITY_CLASS processes, and a base priority of 31 for REALTIME_PRIORITY_CLASS processes. |