openvino-node
Advanced tools
+7
-7
| { | ||
| "name": "openvino-node", | ||
| "version": "2025.1.0", | ||
| "version": "2025.2.0", | ||
| "description": "OpenVINO™ utils for using from Node.js environment", | ||
@@ -30,9 +30,9 @@ "repository": { | ||
| "devDependencies": { | ||
| "@types/node": "^20.5.1", | ||
| "@typescript-eslint/eslint-plugin": "^6.7.0", | ||
| "@typescript-eslint/parser": "^6.7.0", | ||
| "@types/node": "^22.13.4", | ||
| "@typescript-eslint/eslint-plugin": "^8.34.0", | ||
| "@typescript-eslint/parser": "^8.34.0", | ||
| "eslint": "^8.49.0", | ||
| "mocha": "^10.6.0", | ||
| "random-bigint": "^0.0.1", | ||
| "typescript": "^5.0.4", | ||
| "mocha": "^10.6.0" | ||
| "typescript": "^5.0.4" | ||
| }, | ||
@@ -45,3 +45,3 @@ "engines": { | ||
| "https-proxy-agent": "^7.0.2", | ||
| "tar-fs": "^3.0.8" | ||
| "tar-fs": "^3.0.9" | ||
| }, | ||
@@ -48,0 +48,0 @@ "binary": { |
@@ -6,3 +6,3 @@ const os = require('node:os'); | ||
| const fs = require('node:fs/promises'); | ||
| const { createReadStream } = require('node:fs'); | ||
| const { createReadStream, existsSync } = require('node:fs'); | ||
@@ -36,3 +36,3 @@ const { downloadFile, checkIfPathExists, removeDirectory } = require('./utils'); | ||
| } = this.binaryConfig; | ||
| const fullPathTemplate = `${remotePathTemplate}${packageNameTemplate}` | ||
| const fullPathTemplate = `${remotePathTemplate}${packageNameTemplate}`; | ||
| const fullPath = fullPathTemplate | ||
@@ -54,3 +54,4 @@ .replace(new RegExp('{version}', 'g'), this.version) | ||
| /** | ||
| * Prepares the binary by downloading and extracting the OpenVINO runtime archive. | ||
| * Prepares the binary by downloading and extracting the OpenVINO runtime | ||
| * archive. | ||
| * | ||
@@ -61,8 +62,13 @@ * @param {string} packageRoot - The root directory of the package. | ||
| * @param {Object} options - The options for preparing the binary. | ||
| * @param {boolean} options.force - Whether to force the download if the directory already exists. | ||
| * @param {boolean} options.ignoreIfExists - Whether to ignore the download if the directory already exists. | ||
| * @param {string} [options.proxy] - The proxy to use for downloading the file. | ||
| * @throws {Error} If the directory already exists and the force option is not set. | ||
| * @param {boolean} options.force - Whether to force the download if the | ||
| * directory already exists. | ||
| * @param {boolean} options.ignoreIfExists - Whether to ignore the download | ||
| * if the directory already exists. | ||
| * @param {string} [options.proxy] - The proxy to use for downloading the | ||
| * file. | ||
| * @throws {Error} If the directory already exists and the force option | ||
| * is not set. | ||
| * @throws {Error} If the download or extraction fails. | ||
| * @returns {Promise<void>} A promise that resolves when the binary is prepared. | ||
| * @returns {Promise<void>} A promise that resolves when the binary is | ||
| * prepared. | ||
| */ | ||
@@ -90,2 +96,21 @@ static async prepareBinary(packageRoot, version, binaryConfig, options) { | ||
| // Install binaries from directories if possible | ||
| if (process.env.npm_package_resolved?.startsWith('file:')) { | ||
| const binDir = path.join( | ||
| path.dirname(process.env.npm_package_resolved), | ||
| 'bin' | ||
| ).replace('file:', ''); | ||
| if (existsSync(path.join(binDir, 'libopenvino.so')) || | ||
| existsSync(path.join(binDir, 'openvino.dll'))) { | ||
| try { | ||
| await fs.cp(binDir, destinationPath, {'recursive': true}); | ||
| return; | ||
| } catch(error) { | ||
| console.error(`Failed to copy bin directory: ${error}.`); | ||
| } | ||
| } | ||
| console.log('Do not find bin directory with openvino library.'); | ||
| } | ||
| const archiveUrl = binaryManager.getArchiveUrl(); | ||
@@ -107,3 +132,3 @@ let tempDirectoryPath = null; | ||
| options.proxy, | ||
| ) | ||
| ); | ||
| console.log('OpenVINO runtime archive downloaded.'); | ||
@@ -128,5 +153,7 @@ | ||
| * | ||
| * If the platform or architecture is not supported, an error message is logged to the console. | ||
| * If the platform or architecture is not supported, an error message | ||
| * is logged to the console. | ||
| * | ||
| * @returns {boolean} Returns true if the platform and architecture are compatible, otherwise false. | ||
| * @returns {boolean} Returns true if the platform and architecture are | ||
| * compatible, otherwise false. | ||
| */ | ||
@@ -150,2 +177,3 @@ static isCompatible() { | ||
| console.error(missleadings.join(' ')); | ||
| return false; | ||
@@ -152,0 +180,0 @@ } |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
42565
1.71%924
2.78%5
150%Updated