Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

thread-cpu-usage

Package Overview
Dependencies
Maintainers
0
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

thread-cpu-usage - npm Package Compare versions

Comparing version 0.2.0-alpha.7 to 0.2.0-alpha.8

lib/utils.js

12

index.js

@@ -1,13 +0,5 @@

import { existsSync } from 'node:fs'
import { createRequire } from 'node:module'
import { arch, platform } from 'node:os'
import { resolve } from 'node:path'
import { getNativeAddonPath } from './lib/utils.js'
const addonPath = resolve(
import.meta.dirname,
'native',
`${platform()}-${arch()}-${existsSync('/etc/alpine-release') ? 'musl' : 'glibc'}.node`
)
const require = createRequire(import.meta.url)
export const threadCpuUsage = require(addonPath).threadCpuUsage
export const threadCpuUsage = require(getNativeAddonPath()).threadCpuUsage
{
"name": "thread-cpu-usage",
"version": "0.2.0-alpha.7",
"version": "0.2.0-alpha.8",
"description": "Get CPU usage per thread",

@@ -20,2 +20,3 @@ "homepage": "https://github.com/platformatic/thread-cpu-usage#readme",

"index.js",
"lib",
"native",

@@ -22,0 +23,0 @@ "scripts",

import { spawn } from 'node:child_process'
import { once } from 'node:events'
import { existsSync } from 'node:fs'
import { platform } from 'node:os'
import { getNativeAddonPath } from './helper.js'
import { getNativeAddonPath, isWindows } from '../lib/utils.js'

@@ -10,6 +9,5 @@ const addonPath = getNativeAddonPath()

if (process.env.npm_config_build_from_source === 'true' || !existsSync(addonPath)) {
const subprocess =
platform() === 'win32'
? spawn('npm run build', { shell: true, windowsVerbatimArguments: true, stdio: 'inherit' })
: spawn('npm', ['run', 'build'], { stdio: 'inherit' })
const subprocess = isWindows
? spawn('npm run build', { shell: true, windowsVerbatimArguments: true, stdio: 'inherit' })
: spawn('npm', ['run', 'build'], { stdio: 'inherit' })

@@ -16,0 +14,0 @@ const [code] = await once(subprocess, 'exit')

import { cp, rm } from 'node:fs/promises'
import { resolve } from 'node:path'
import { cleanNativeDirectory, getNativeAddonPath } from './helper.js'
import { cleanNativeDirectory, getNativeAddonPath } from '../lib/utils.js'

@@ -5,0 +5,0 @@ try {

@@ -1,3 +0,3 @@

import { getNativeTriplet } from './helper.js'
import { getNativeTriplet } from '../lib/utils.js'
console.log(`Current target: ${getNativeTriplet().join('-')}`)
import { cp, glob } from 'node:fs/promises'
import { basename, dirname, resolve } from 'node:path'
import { cleanNativeDirectory, nativeDir } from './helper.js'
import { cleanNativeDirectory, nativeDir } from '../lib/utils.js'

@@ -5,0 +5,0 @@ await cleanNativeDirectory()

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc