Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

touch

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

touch

like touch(1) in node

  • 3.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
7.2M
increased by13%
Maintainers
1
Weekly downloads
 
Created

What is touch?

The 'touch' npm package is used to create and update the access and modification times of files, similar to the Unix touch command.

What are touch's main functionalities?

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');
});

Other packages similar to touch

FAQs

Package last updated on 30 Jun 2017

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc