Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
electron-utimes
Advanced tools
Native addon to change the btime, mtime, and atime of a file on Windows, macOS, and Linux.
electron-utimes
is to be compatible with the Electron project.Native addon to change the creation time (btime
), modified time (mtime
), and access time (atime
) of files, directories, and symbolic links on Windows, macOS, and Linux.
npm install utimes
The utimes()
function is used to update the timestamps on files and directories. For paths which resolve to symbolic links, the link's target file will be changed instead.
import { utimes } from 'utimes';
// Change all times at once
await utimes('/path/to/file', 447775200000);
// Change specific times (set to undefined or 0 to keep the same value)
await utimes('/path/to/file', {
btime: 447775200000,
mtime: undefined,
atime: undefined
});
The lutimes()
function is identical to utimes()
, but for paths which resolve to symbolic links, the links themselves will be changed, and their target files will be unaffected.
import { lutimes } from 'utimes';
await lutimes('/path/to/symlink', {
btime: 447775200000
});
You can provide a function as the last argument to activate callback mode. The first parameter of the callback will be the error if applicable (or undefined
otherwise).
If you're looking for maximum performance, using callbacks is recommended to avoid the slight delay in promise resolution.
utimes('/path/to/file', 447775200000, function(error) {
// Do something!
});
This package also offers synchronous versions of its functions.
import { utimesSync, lutimesSync } from 'utimes';
utimesSync('/path/to/file', 447775200000);
lutimesSync('/path/to/symlink', 447775200000);
This package throws descriptive and user-friendly error messages. These messages come from the operating system and may not be consistent between platforms. Here's an example:
Error {
message: "No such file or directory, utimes '/path/to/file'"
}
This package uses C++ bindings that must be built for the current operating system and architecture. Because build tools are often not available, prebuilt binaries are provided for common platforms, and will be downloaded where applicable during package installation. These binaries are public and can be found on the releases page.
The latest version of utimes
provides the following prebuilt binaries:
x86 | x64 | armv7 | arm64 | |
---|---|---|---|---|
win32 | ✅ | ✅ | - | - |
darwin | ✅ | ✅ | - | - |
linux | ✅ | ✅ | ✅ | ✅ |
If the native binding cannot be downloaded nor built, the package will fall back to using the built-in fs
functions. This means btime
will not be modifiable on any platform, and performance will decrease moderately.
btime
and attempts to do so will be silently ignored. Other changes set at the same time will still be applied, so you don't need to check for this yourself.This was originally a fork of @ronomon/utimes with cross-platform improvements by Jule-. It's not backwards compatible. For those who are migrating from that package, here are the notable changes:
lutimes
)Huge thanks to all of the contributors who helped with maintaining and improving this package!
FAQs
Native addon to change the btime, mtime, and atime of a file on Windows, macOS, and Linux.
The npm package electron-utimes receives a total of 0 weekly downloads. As such, electron-utimes popularity was classified as not popular.
We found that electron-utimes demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.