extract-base-iterator
Version:
Base iterator for extract iterators like tar-iterator and zip-iterator
33 lines • 1.45 kB
JavaScript
// lutimes - set times on symlinks without following them
// fs.lutimes was added in Node.js 14.5.0
// For older versions, we skip setting times on symlinks (no good alternative)
;
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "default", {
enumerable: true,
get: function() {
return lutimes;
}
});
var _fs = /*#__PURE__*/ _interop_require_default(require("fs"));
function _interop_require_default(obj) {
return obj && obj.__esModule ? obj : {
default: obj
};
}
// biome-ignore lint/suspicious/noExplicitAny: fs.lutimes not in older @types/node
var HAS_LUTIMES = typeof _fs.default.lutimes === 'function';
function lutimes(fullPath, entry, options, callback) {
if (HAS_LUTIMES) {
var now = options.now || new Date();
// biome-ignore lint/suspicious/noExplicitAny: fs.lutimes not in older @types/node
_fs.default.lutimes(fullPath, now, new Date(entry.mtime), callback);
} else {
// On older Node versions, skip setting times on symlinks
// fs.utimes follows symlinks and will fail with ENOENT if target doesn't exist
callback(null);
}
}
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }