npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript.Learn more »

@alexbinary/touchp

1.0.4 • Public • Published

touchp

Simple touchp with promise support 🎉

npm GitHub release Build Status dependencies Status devDependencies Status

Based on touchp by rschmukler

Uses @alexbinary/promisify by alexbinary

Install

Install using npm or yarn :

$ npm install @alexbinary/touchp
# or 
$ yarn add @alexbinary/touchp

Usage

let touchp = require('@alexbinary/touchp')
 
// promise
touchp('/foo/bar').then(() => {
  console.log('file created')
})
 
// callback
touchp('/foo/bar', (err) => {
  if (!err) {
    console.log('file created')
  }
})
 
// sync
touchp.sync('/foo/bar')
console.log('file created')

Documentation

let touchp = require('@alexbinary/touchp')

touchp(filepath[, callback])

Creates an empty file at filepath. Creates intermediary directories if necessary.

callback is an optional node style callback with no arguments except for a possible error.
Always returns a Promise which resolves with no arguments.

touchp.sync(filepath)

Synchronous version.

Licence

MIT

install

npm i @alexbinary/touchp

Downloadsweekly downloads

89

version

1.0.4

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability