https://github.com/alexbinary/touchp
Simple touchp with promise support 🎉
https://github.com/alexbinary/touchp
Last synced: 19 days ago
JSON representation
Simple touchp with promise support 🎉
- Host: GitHub
- URL: https://github.com/alexbinary/touchp
- Owner: alexbinary
- License: mit
- Created: 2016-12-18T10:19:16.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-12-29T10:00:47.000Z (over 8 years ago)
- Last Synced: 2025-06-12T20:34:34.265Z (about 1 month ago)
- Language: JavaScript
- Homepage:
- Size: 49.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# touchp
Simple touchp with promise support 🎉
[](https://www.npmjs.com/package/@alexbinary/touchp)
[](https://github.com/alexbinary/touchp/releases/latest)
[](https://travis-ci.org/alexbinary/touchp)
[](https://david-dm.org/alexbinary/touchp)
[](https://david-dm.org/alexbinary/touchp?type=dev)Based on [touchp](https://www.npmjs.com/package/touchp) by [rschmukler](https://www.npmjs.com/~rschmukler)
Uses [@alexbinary/promisify](https://www.npmjs.com/package/@alexbinary/promisify) by [alexbinary](https://www.npmjs.com/~alexbinary)
## Install
Install using npm or yarn :
```bash
$ npm install @alexbinary/touchp
# or
$ yarn add @alexbinary/touchp
```## Usage
```javascript
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
```javascript
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