New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

nw-builder

Package Overview
Dependencies
Maintainers
3
Versions
160
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nw-builder - npm Package Compare versions

Comparing version 4.6.1 to 4.6.2

5

package.json
{
"name": "nw-builder",
"version": "4.6.1",
"version": "4.6.2",
"description": "Build NW.js desktop applications for MacOS, Windows and Linux.",

@@ -45,3 +45,4 @@ "keywords": [

"lint": "eslint ./src/**/*.js ./test/**/*.js",
"lint:fix": "eslint --fix ./**/*.{js,md} && markdownlint --fix ./README.md",
"lint:fix": "eslint --fix ./src/**/*.js ./test/**/*.js",
"markdown:fix": "markdownlint --fix ./README.md",
"docs": "jsdoc -d docs ./README.md ./src/index.js ./src/get.js ./src/run.js ./src/bld.js",

@@ -48,0 +49,0 @@ "test": "vitest run",

49

src/get/decompress.js

@@ -50,24 +50,25 @@ import fs from "node:fs";

const zip = await yauzl.open(zippedFile);
let entry = await zip.readEntry();
const symlinks = []; // Array to hold symbolic link entries
while (entry !== null) {
let entryPathAbs = path.join(cacheDir, entry.filename);
/* Create the directory beforehand to prevent `ENOENT: no such file or directory` errors. */
await fs.promises.mkdir(path.dirname(entryPathAbs), { recursive: true });
/* Check if entry is a symbolic link */
// Check if entry is a symbolic link
const isSymlink = ((modeFromEntry(entry) & 0o170000) === 0o120000);
const readStream = await entry.openReadStream();
if (isSymlink) {
const chunks = [];
/* Read stream into Array. */
readStream.on("data", (chunk) => chunks.push(chunk));
await stream.promises.finished(readStream);
const link = Buffer.concat(chunks).toString('utf8').trim();
await fs.promises.symlink(link, entryPathAbs)
// Store symlink entries to process later
symlinks.push(entry);
} else {
// Pipe read to write stream
const writeStream = fs.createWriteStream(entryPathAbs);
await stream.promises.pipeline(readStream, writeStream);
// Handle regular files and directories
await fs.promises.mkdir(path.dirname(entryPathAbs), {recursive: true});
if (!entry.filename.endsWith('/')) { // Skip directories
const readStream = await entry.openReadStream();
const writeStream = fs.createWriteStream(entryPathAbs);
await stream.promises.pipeline(readStream, writeStream);
// Set file permissions after the file has been written
const mode = modeFromEntry(entry);
await fs.promises.chmod(entryPathAbs, mode);
}
}

@@ -78,2 +79,20 @@

}
// Process symbolic links after all other files have been extracted
for (const symlinkEntry of symlinks) {
let entryPathAbs = path.join(cacheDir, symlinkEntry.filename);
const readStream = await symlinkEntry.openReadStream();
const chunks = [];
readStream.on("data", (chunk) => chunks.push(chunk));
await new Promise(resolve => readStream.on("end", resolve));
const linkTarget = Buffer.concat(chunks).toString('utf8').trim();
// Check if the symlink or a file/directory already exists at the destination
if (fs.existsSync(entryPathAbs)) {
//skip
} else {
// Create symbolic link
await fs.promises.symlink(linkTarget, entryPathAbs);
}
}
}

@@ -100,3 +100,3 @@ import fs from "node:fs";

options.cacheDir,
`nwjs${options.flavor === "sdk" ? "-sdk" : ""}-v${options.version}-${options.platform}-${options.arch}.zip`,
`ffmpeg-${options.version}-${options.platform}-${options.arch}.zip`,
);

@@ -119,3 +119,6 @@

if (ffmpegFilePathExists === false) {
ffmpegFilePath = await ffmpeg(options.downloadUrl, options.version, options.platform, options.arch, options.cacheDir);
// Do not update the options.downloadUrl with the ffmpeg URL here. Doing so would lead to error when options.ffmpeg and options.nativeAddon are both enabled.
const downloadUrl =
"https://github.com/nwjs-ffmpeg-prebuilt/nwjs-ffmpeg-prebuilt/releases/download";
ffmpegFilePath = await ffmpeg(downloadUrl, options.version, options.platform, options.arch, options.cacheDir);
}

@@ -122,0 +125,0 @@

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