Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoSign in
Socket

@actions/io

Package Overview
Dependencies
Maintainers
6
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@actions/io - npm Package Compare versions

Comparing version
1.1.3
to
2.0.0
+13
-2
lib/io-util.d.ts

@@ -1,5 +0,16 @@

/// <reference types="node" />
import * as fs from 'fs';
export declare const chmod: typeof fs.promises.chmod, copyFile: typeof fs.promises.copyFile, lstat: typeof fs.promises.lstat, mkdir: typeof fs.promises.mkdir, open: typeof fs.promises.open, readdir: typeof fs.promises.readdir, readlink: typeof fs.promises.readlink, rename: typeof fs.promises.rename, rm: typeof fs.promises.rm, rmdir: typeof fs.promises.rmdir, stat: typeof fs.promises.stat, symlink: typeof fs.promises.symlink, unlink: typeof fs.promises.unlink;
export declare const chmod: typeof fs.promises.chmod, copyFile: typeof fs.promises.copyFile, lstat: typeof fs.promises.lstat, mkdir: typeof fs.promises.mkdir, open: typeof fs.promises.open, readdir: typeof fs.promises.readdir, rename: typeof fs.promises.rename, rm: typeof fs.promises.rm, rmdir: typeof fs.promises.rmdir, stat: typeof fs.promises.stat, symlink: typeof fs.promises.symlink, unlink: typeof fs.promises.unlink;
export declare const IS_WINDOWS: boolean;
/**
* Custom implementation of readlink to ensure Windows junctions
* maintain trailing backslash for backward compatibility with Node.js < 24
*
* In Node.js 20, Windows junctions (directory symlinks) always returned paths
* with trailing backslashes. Node.js 24 removed this behavior, which breaks
* code that relied on this format for path operations.
*
* This implementation restores the Node 20 behavior by adding a trailing
* backslash to all junction results on Windows.
*/
export declare function readlink(fsPath: string): Promise<string>;
export declare const UV_FS_O_EXLOCK = 268435456;

@@ -6,0 +17,0 @@ export declare const READONLY: number;

+65
-24
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -14,9 +18,19 @@ if (k2 === undefined) k2 = k;

});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -33,3 +47,9 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

Object.defineProperty(exports, "__esModule", { value: true });
exports.getCmdPath = exports.tryGetExecutablePath = exports.isRooted = exports.isDirectory = exports.exists = exports.READONLY = exports.UV_FS_O_EXLOCK = exports.IS_WINDOWS = exports.unlink = exports.symlink = exports.stat = exports.rmdir = exports.rm = exports.rename = exports.readlink = exports.readdir = exports.open = exports.mkdir = exports.lstat = exports.copyFile = exports.chmod = void 0;
exports.READONLY = exports.UV_FS_O_EXLOCK = exports.IS_WINDOWS = exports.unlink = exports.symlink = exports.stat = exports.rmdir = exports.rm = exports.rename = exports.readdir = exports.open = exports.mkdir = exports.lstat = exports.copyFile = exports.chmod = void 0;
exports.readlink = readlink;
exports.exists = exists;
exports.isDirectory = isDirectory;
exports.isRooted = isRooted;
exports.tryGetExecutablePath = tryGetExecutablePath;
exports.getCmdPath = getCmdPath;
const fs = __importStar(require("fs"));

@@ -39,5 +59,27 @@ const path = __importStar(require("path"));

// export const {open} = 'fs'
, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.open = _a.open, exports.readdir = _a.readdir, exports.readlink = _a.readlink, exports.rename = _a.rename, exports.rm = _a.rm, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink;
, exports.chmod = _a.chmod, exports.copyFile = _a.copyFile, exports.lstat = _a.lstat, exports.mkdir = _a.mkdir, exports.open = _a.open, exports.readdir = _a.readdir, exports.rename = _a.rename, exports.rm = _a.rm, exports.rmdir = _a.rmdir, exports.stat = _a.stat, exports.symlink = _a.symlink, exports.unlink = _a.unlink;
// export const {open} = 'fs'
exports.IS_WINDOWS = process.platform === 'win32';
/**
* Custom implementation of readlink to ensure Windows junctions
* maintain trailing backslash for backward compatibility with Node.js < 24
*
* In Node.js 20, Windows junctions (directory symlinks) always returned paths
* with trailing backslashes. Node.js 24 removed this behavior, which breaks
* code that relied on this format for path operations.
*
* This implementation restores the Node 20 behavior by adding a trailing
* backslash to all junction results on Windows.
*/
function readlink(fsPath) {
return __awaiter(this, void 0, void 0, function* () {
const result = yield fs.promises.readlink(fsPath);
// On Windows, restore Node 20 behavior: add trailing backslash to all results
// since junctions on Windows are always directory links
if (exports.IS_WINDOWS && !result.endsWith('\\')) {
return `${result}\\`;
}
return result;
});
}
// See https://github.com/nodejs/node/blob/d0153aee367422d0858105abec186da4dff0a0c5/deps/uv/include/uv/win.h#L691

@@ -49,3 +91,3 @@ exports.UV_FS_O_EXLOCK = 0x10000000;

try {
yield exports.stat(fsPath);
yield (0, exports.stat)(fsPath);
}

@@ -61,10 +103,8 @@ catch (err) {

}
exports.exists = exists;
function isDirectory(fsPath, useStat = false) {
return __awaiter(this, void 0, void 0, function* () {
const stats = useStat ? yield exports.stat(fsPath) : yield exports.lstat(fsPath);
function isDirectory(fsPath_1) {
return __awaiter(this, arguments, void 0, function* (fsPath, useStat = false) {
const stats = useStat ? yield (0, exports.stat)(fsPath) : yield (0, exports.lstat)(fsPath);
return stats.isDirectory();
});
}
exports.isDirectory = isDirectory;
/**

@@ -85,3 +125,2 @@ * On OSX/Linux, true if path starts with '/'. On Windows, true for paths like:

}
exports.isRooted = isRooted;
/**

@@ -98,3 +137,3 @@ * Best effort attempt to determine whether a file exists and is executable.

// test file exists
stats = yield exports.stat(filePath);
stats = yield (0, exports.stat)(filePath);
}

@@ -127,3 +166,3 @@ catch (err) {

try {
stats = yield exports.stat(filePath);
stats = yield (0, exports.stat)(filePath);
}

@@ -142,3 +181,3 @@ catch (err) {

const upperName = path.basename(filePath).toUpperCase();
for (const actualName of yield exports.readdir(directory)) {
for (const actualName of yield (0, exports.readdir)(directory)) {
if (upperName === actualName.toUpperCase()) {

@@ -166,3 +205,2 @@ filePath = path.join(directory, actualName);

}
exports.tryGetExecutablePath = tryGetExecutablePath;
function normalizeSeparators(p) {

@@ -184,4 +222,8 @@ p = p || '';

return ((stats.mode & 1) > 0 ||
((stats.mode & 8) > 0 && stats.gid === process.getgid()) ||
((stats.mode & 64) > 0 && stats.uid === process.getuid()));
((stats.mode & 8) > 0 &&
process.getgid !== undefined &&
stats.gid === process.getgid()) ||
((stats.mode & 64) > 0 &&
process.getuid !== undefined &&
stats.uid === process.getuid()));
}

@@ -193,3 +235,2 @@ // Get the path of cmd.exe in windows

}
exports.getCmdPath = getCmdPath;
//# sourceMappingURL=io-util.js.map
+33
-20
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -14,9 +18,19 @@ if (k2 === undefined) k2 = k;

});
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
__setModuleDefault(result, mod);
return result;
};
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

@@ -32,3 +46,8 @@ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }

Object.defineProperty(exports, "__esModule", { value: true });
exports.findInPath = exports.which = exports.mkdirP = exports.rmRF = exports.mv = exports.cp = void 0;
exports.cp = cp;
exports.mv = mv;
exports.rmRF = rmRF;
exports.mkdirP = mkdirP;
exports.which = which;
exports.findInPath = findInPath;
const assert_1 = require("assert");

@@ -45,4 +64,4 @@ const path = __importStar(require("path"));

*/
function cp(source, dest, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
function cp(source_1, dest_1) {
return __awaiter(this, arguments, void 0, function* (source, dest, options = {}) {
const { force, recursive, copySourceDirectory } = readCopyOptions(options);

@@ -79,3 +98,2 @@ const destStat = (yield ioUtil.exists(dest)) ? yield ioUtil.stat(dest) : null;

}
exports.cp = cp;
/**

@@ -88,4 +106,4 @@ * Moves a path.

*/
function mv(source, dest, options = {}) {
return __awaiter(this, void 0, void 0, function* () {
function mv(source_1, dest_1) {
return __awaiter(this, arguments, void 0, function* (source, dest, options = {}) {
if (yield ioUtil.exists(dest)) {

@@ -111,3 +129,2 @@ let destExists = true;

}
exports.mv = mv;
/**

@@ -141,3 +158,2 @@ * Remove a path recursively with force

}
exports.rmRF = rmRF;
/**

@@ -152,7 +168,6 @@ * Make a directory. Creates the full path with folders in between

return __awaiter(this, void 0, void 0, function* () {
assert_1.ok(fsPath, 'a path argument must be provided');
(0, assert_1.ok)(fsPath, 'a path argument must be provided');
yield ioUtil.mkdir(fsPath, { recursive: true });
});
}
exports.mkdirP = mkdirP;
/**

@@ -191,3 +206,2 @@ * Returns path of a tool had the tool actually been invoked. Resolves via paths.

}
exports.which = which;
/**

@@ -249,3 +263,2 @@ * Returns a list of all occurrences of the given tool on the system path.

}
exports.findInPath = findInPath;
function readCopyOptions(options) {

@@ -252,0 +265,0 @@ const force = options.force == null ? true : options.force;

{
"name": "@actions/io",
"version": "1.1.3",
"version": "2.0.0",
"description": "Actions io lib",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet