| [81bc7da] | 1 | # node-touch
|
|---|
| 2 |
|
|---|
| 3 | For all your node touching needs.
|
|---|
| 4 |
|
|---|
| 5 | ## Installing
|
|---|
| 6 |
|
|---|
| 7 | ```bash
|
|---|
| 8 | npm install touch
|
|---|
| 9 | ```
|
|---|
| 10 |
|
|---|
| 11 | ## CLI Usage:
|
|---|
| 12 |
|
|---|
| 13 | See `man touch`
|
|---|
| 14 |
|
|---|
| 15 | This package exports a binary called `nodetouch` that works mostly
|
|---|
| 16 | like the unix builtin `touch(1)`.
|
|---|
| 17 |
|
|---|
| 18 | ## API Usage:
|
|---|
| 19 |
|
|---|
| 20 | ```javascript
|
|---|
| 21 | var touch = require("touch")
|
|---|
| 22 | ```
|
|---|
| 23 |
|
|---|
| 24 | Gives you the following functions:
|
|---|
| 25 |
|
|---|
| 26 | * `touch(filename, options, cb)`
|
|---|
| 27 | * `touch.sync(filename, options)`
|
|---|
| 28 | * `touch.ftouch(fd, options, cb)`
|
|---|
| 29 | * `touch.ftouchSync(fd, options)`
|
|---|
| 30 |
|
|---|
| 31 | All the `options` objects are optional.
|
|---|
| 32 |
|
|---|
| 33 | All the async functions return a Promise. If a callback function is
|
|---|
| 34 | provided, then it's attached to the Promise.
|
|---|
| 35 |
|
|---|
| 36 | ## Options
|
|---|
| 37 |
|
|---|
| 38 | * `force` like `touch -f` Boolean
|
|---|
| 39 | * `time` like `touch -t <date>` Can be a Date object, or any parseable
|
|---|
| 40 | Date string, or epoch ms number.
|
|---|
| 41 | * `atime` like `touch -a` Can be either a Boolean, or a Date.
|
|---|
| 42 | * `mtime` like `touch -m` Can be either a Boolean, or a Date.
|
|---|
| 43 | * `ref` like `touch -r <file>` Must be path to a file.
|
|---|
| 44 | * `nocreate` like `touch -c` Boolean
|
|---|
| 45 |
|
|---|
| 46 | If neither `atime` nor `mtime` are set, then both values are set. If
|
|---|
| 47 | one of them is set, then the other is not.
|
|---|
| 48 |
|
|---|
| 49 | ## cli
|
|---|
| 50 |
|
|---|
| 51 | This package creates a `nodetouch` command line executable that works
|
|---|
| 52 | very much like the unix builtin `touch(1)`
|
|---|