@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

/@alexbinary/touchp/

    Package Sidebar

    Install

    npm i @alexbinary/touchp

    Weekly Downloads

    54

    Version

    1.0.4

    License

    MIT

    Last publish

    Collaborators

    • alexbinary