Socket
Socket
Sign inDemoInstall

opencv4nodejs-prebuilt

Package Overview
Dependencies
71
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 5.3.0-beta1 to 5.3.0-beta2

46

lib/cv.js
const path = require('path');
const opencvBuild = require(`@nut-tree/opencv-build-${process.platform}`)
const { resolvePath } = require('./commons');

@@ -9,30 +8,2 @@

function tryGetOpencvBinDir() {
if (process.env.OPENCV_BIN_DIR) {
logDebug('tryGetOpencvBinDir', 'OPENCV_BIN_DIR environment variable is set')
return process.env.OPENCV_BIN_DIR
}
// if the auto build is not disabled via environment do not even attempt
// to read package.json
if (!opencvBuild.isAutoBuildDisabled()) {
logDebug('tryGetOpencvBinDir', 'auto build has not been disabled via environment variable, using opencv bin dir of opencv-build')
return opencvBuild.opencvBinDir
}
logDebug('tryGetOpencvBinDir', 'auto build has not been explicitly disabled via environment variable, attempting to read envs from package.json...')
const envs = opencvBuild.readEnvsFromPackageJson()
if (!envs.disableAutoBuild) {
logDebug('tryGetOpencvBinDir', 'auto build has not been disabled via package.json, using opencv bin dir of opencv-build')
return opencvBuild.opencvBinDir
}
if (envs.opencvBinDir) {
logDebug('tryGetOpencvBinDir', 'found opencv binary environment variable in package.json')
return envs.opencvBinDir
}
logDebug('tryGetOpencvBinDir', 'failed to find opencv binary environment variable in package.json')
return null
}
let cv = null

@@ -44,18 +15,3 @@ try {

logDebug('require', 'failed to require cv with exception: ' + err.toString())
logDebug('require', 'attempting to add opencv binaries to path')
if (!process.env.path) {
logDebug('require', 'there is no path environment variable, skipping...')
throw err
}
const opencvBinDir = tryGetOpencvBinDir()
logDebug('require', 'adding opencv binary dir to path: ' + opencvBinDir)
// ensure binaries are added to path on windows
if (!process.env.path.includes(opencvBinDir)) {
process.env.path = `${process.env.path};${opencvBinDir};`
}
logDebug('require', 'process.env.path: ' + process.env.path)
cv = require(requirePath);
throw err
}

@@ -62,0 +18,0 @@

4

package.json
{
"name": "opencv4nodejs-prebuilt",
"version": "5.3.0-beta1",
"version": "5.3.0-beta2",
"description": "Asynchronous OpenCV 3.x nodejs bindings with JavaScript and TypeScript API.",

@@ -57,3 +57,3 @@ "keywords": [

},
"opencv": "4.1.1-beta4",
"opencv": "4.1.1",
"devDependencies": {

@@ -60,0 +60,0 @@ "prebuild": "^9.1.0"

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc