Security News
vlt Debuts New JavaScript Package Manager and Serverless Registry at NodeConf EU
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
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
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)
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.
FAQs
like touch(1) in node
The npm package touch receives a total of 5,089,032 weekly downloads. As such, touch popularity was classified as popular.
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.
Security News
vlt introduced its new package manager and a serverless registry this week, innovating in a space where npm has stagnated.
Security News
Research
The Socket Research Team uncovered a malicious Python package typosquatting the popular 'fabric' SSH library, silently exfiltrating AWS credentials from unsuspecting developers.
Security News
At its inaugural meeting, the JSR Working Group outlined plans for an open governance model and a roadmap to enhance JavaScript package management.