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.
The 'touch' npm package is used to create and update the access and modification times of files, similar to the Unix touch command.
Create a new file
This feature allows you to create a new file named 'newfile.txt'. If the file already exists, it updates the access and modification times.
const touch = require('touch');
touch('newfile.txt', function(err) {
if (err) throw err;
console.log('File created');
});
Update access and modification times
This feature updates the access and modification times of an existing file named 'existingfile.txt' to the current date and time.
const touch = require('touch');
touch('existingfile.txt', { time: new Date() }, function(err) {
if (err) throw err;
console.log('Timestamps updated');
});
Force create a file
This feature forces the creation of a file named 'forcefile.txt' even if the parent directory does not exist.
const touch = require('touch');
touch('forcefile.txt', { force: true }, function(err) {
if (err) throw err;
console.log('File created or updated with force');
});
The 'fs-extra' package provides additional file system methods that aren't included in the native 'fs' module. It includes methods for creating and updating files, similar to 'touch', but also offers a wider range of file system operations like copying, moving, and removing files and directories.
The 'node-fs' package extends the native 'fs' module with additional file system methods. It includes functionality for creating and updating files, similar to 'touch', but also provides methods for recursive directory creation and symbolic link management.
The 'file-system' package is a simple wrapper around the native 'fs' module that provides additional convenience methods for file operations. It includes methods for creating and updating files, similar to 'touch', but also offers methods for reading and writing JSON files and working with directories.
For all your node touching needs.
npm install touch
See man touch
This package exports a binary called nodetouch
that works mostly
like the unix builtin touch(1)
.
var touch = require("touch")
Gives you the following functions:
touch(filename, options, cb)
touch.sync(filename, options)
touch.ftouch(fd, options, cb)
touch.ftouchSync(fd, options)
All the options
objects are optional.
All the async functions return a Promise. If a callback function is provided, then it's attached to the Promise.
force
like touch -f
Booleantime
like touch -t <date>
Can be a Date object, or any parseable
Date string, or epoch ms number.atime
like touch -a
Can be either a Boolean, or a Date.mtime
like touch -m
Can be either a Boolean, or a Date.ref
like touch -r <file>
Must be path to a file.nocreate
like touch -c
BooleanIf neither atime
nor mtime
are set, then both values are set. If
one of them is set, then the other is not.
This package creates a nodetouch
command line executable that works
very much like the unix builtin touch(1)
FAQs
like touch(1) in node
We found that touch demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.