Skip to content

Commit

Permalink
docs: Refactor docs to include parameters type
Browse files Browse the repository at this point in the history
  • Loading branch information
manidlou committed Mar 9, 2017
1 parent e46b820 commit fc5fca9
Show file tree
Hide file tree
Showing 24 changed files with 100 additions and 20 deletions.
14 changes: 8 additions & 6 deletions docs/copy-sync.md
Expand Up @@ -2,12 +2,14 @@

Copy a file or directory. The directory can have contents. Like `cp -r`.

## Options:
- overwrite (boolean): overwrite existing file or directory, default is `true`. _Note that the copy operation will silently fail if you set this to `false` and the destination exists._ Use the `errorOnExist` option to change this behavior.
- errorOnExist (boolean): when `overwrite` is `false` and the destination exists, throw an error. Default is `false`.
- dereference (boolean): dereference symlinks, default is `false`.
- preserveTimestamps (boolean): will set last modification and access times to the ones of the original source files, default is `false`.
- filter: Function to filter copied files. Return `true` to include, `false` to exclude. This can also be a RegExp, however this is deprecated (See [issue #239](https://github.com/jprichardson/node-fs-extra/issues/239) for background).
- `src` `<String>`
- `dest` `<String>`
- `options` `<Object>`
- `overwrite` `<boolean>`: overwrite existing file or directory, default is `true`. _Note that the copy operation will silently fail if you set this to `false` and the destination exists._ Use the `errorOnExist` option to change this behavior.
- `errorOnExist` `<boolean>`: when `overwrite` is `false` and the destination exists, throw an error. Default is `false`.
- `dereference` `<boolean>`: dereference symlinks, default is `false`.
- `preserveTimestamps` `<boolean>`: will set last modification and access times to the ones of the original source files, default is `false`.
- `filter` `<Function>`: Function to filter copied files. Return `true` to include, `false` to exclude. This can also be a RegExp, however this is deprecated (See [issue #239](https://github.com/jprichardson/node-fs-extra/issues/239) for background).

## Example:

Expand Down
15 changes: 9 additions & 6 deletions docs/copy.md
Expand Up @@ -2,12 +2,15 @@

Copy a file or directory. The directory can have contents. Like `cp -r`.

## Options:
- overwrite (boolean): overwrite existing file or directory, default is `true`. _Note that the copy operation will silently fail if you set this to `false` and the destination exists._ Use the `errorOnExist` option to change this behavior.
- errorOnExist (boolean): when `overwrite` is `false` and the destination exists, throw an error. Default is `false`.
- dereference (boolean): dereference symlinks, default is `false`.
- preserveTimestamps (boolean): will set last modification and access times to the ones of the original source files, default is `false`.
- filter: Function to filter copied files. Return `true` to include, `false` to exclude. This can also be a RegExp, however this is deprecated (See [issue #239](https://github.com/jprichardson/node-fs-extra/issues/239) for background).
- `src` `<String>`
- `dest` `<String>`
- `options` `<Object>`
- `overwrite` `<boolean>`: overwrite existing file or directory, default is `true`. _Note that the copy operation will silently fail if you set this to `false` and the destination exists._ Use the `errorOnExist` option to change this behavior.
- `errorOnExist` `<boolean>`: when `overwrite` is `false` and the destination exists, throw an error. Default is `false`.
- `dereference` `<boolean>`: dereference symlinks, default is `false`.
- `preserveTimestamps` `<boolean>`: will set last modification and access times to the ones of the original source files, default is `false`.
- `filter` `<Function>`: Function to filter copied files. Return `true` to include, `false` to exclude. This can also be a RegExp, however this is deprecated (See [issue #239](https://github.com/jprichardson/node-fs-extra/issues/239) for background).
- `callback` `<Function>`

## Example:

Expand Down
2 changes: 2 additions & 0 deletions docs/emptyDir-sync.md
Expand Up @@ -4,6 +4,8 @@ Ensures that a directory is empty. Deletes directory contents if the directory i

**Alias:** `emptydirSync()`

- `dir` `<String>`

## Example:

```js
Expand Down
3 changes: 3 additions & 0 deletions docs/emptyDir.md
Expand Up @@ -4,6 +4,9 @@ Ensures that a directory is empty. Deletes directory contents if the directory i

**Alias:** `emptydir()`

- `dir` `<String>`
- `callback` `<Function>`

## Example:

```js
Expand Down
2 changes: 2 additions & 0 deletions docs/ensureDir-sync.md
Expand Up @@ -4,6 +4,8 @@ Ensures that the directory exists. If the directory structure does not exist, it

**Aliases:** `mkdirsSync()`, `mkdirpSync()`

- `dir` `<String>`

## Example:

```js
Expand Down
3 changes: 2 additions & 1 deletion docs/ensureDir.md
Expand Up @@ -4,7 +4,8 @@ Ensures that the directory exists. If the directory structure does not exist, it

**Aliases:** `mkdirs()`, `mkdirp()`

**Sync:** `ensureDirSync()`, `mkdirsSync()`, `mkdirpSync()`
- `dir` `<String>`
- `callback` `<Function>`

## Example:

Expand Down
2 changes: 2 additions & 0 deletions docs/ensureFile-sync.md
Expand Up @@ -4,6 +4,8 @@ Ensures that the file exists. If the file that is requested to be created is in

**Alias:** `createFileSync()`

- `file` `<String>`

## Example:

```js
Expand Down
3 changes: 3 additions & 0 deletions docs/ensureFile.md
Expand Up @@ -4,6 +4,9 @@ Ensures that the file exists. If the file that is requested to be created is in

**Alias:** `createFile()`

- `file` `<String>`
- `callback` `<Function>`

## Example:

```js
Expand Down
3 changes: 3 additions & 0 deletions docs/ensureLink-sync.md
Expand Up @@ -2,6 +2,9 @@

Ensures that the link exists. If the directory structure does not exist, it is created.

- `srcpath` `<String>`
- `dstpath` `<String>`

## Example:

```js
Expand Down
4 changes: 4 additions & 0 deletions docs/ensureLink.md
Expand Up @@ -2,6 +2,10 @@

Ensures that the link exists. If the directory structure does not exist, it is created.

- `srcpath` `<String>`
- `dstpath` `<String>`
- `callback` `<Function>`

## Example:

```js
Expand Down
4 changes: 4 additions & 0 deletions docs/ensureSymlink-sync.md
Expand Up @@ -2,6 +2,10 @@

Ensures that the symlink exists. If the directory structure does not exist, it is created.

- `srcpath` `<String>`
- `dstpath` `<String>`
- `type` `<String>`

## Example:

```js
Expand Down
5 changes: 5 additions & 0 deletions docs/ensureSymlink.md
Expand Up @@ -2,6 +2,11 @@

Ensures that the symlink exists. If the directory structure does not exist, it is created.

- `srcpath` `<String>`
- `dstpath` `<String>`
- `type` `<String>`
- `callback` `<Function>`

## Example:

```js
Expand Down
8 changes: 6 additions & 2 deletions docs/move-sync.md
Expand Up @@ -2,8 +2,10 @@

Moves a file or directory, even across devices.

## Options:
- overwrite (boolean): overwrite existing file or directory, default is `false`
- `src` `<String>`
- `dest` `<String>`
- `options` `<Object>`
- `overwrite` `<boolean>`: overwrite existing file or directory, default is `false`.

## Example:

Expand All @@ -13,6 +15,8 @@ const fs = require('fs-extra')
fs.moveSync('/tmp/somefile', '/tmp/does/not/exist/yet/somefile')
```

**Using `overwrite` option**

```js
const fs = require('fs-extra')

Expand Down
9 changes: 7 additions & 2 deletions docs/move.md
Expand Up @@ -2,8 +2,11 @@

Moves a file or directory, even across devices.

## Options:
- overwrite (boolean): overwrite existing file or directory, default is `false`
- `src` `<String>`
- `dest` `<String>`
- `options` `<Object>`
- `overwrite` `<boolean>`: overwrite existing file or directory, default is `false`.
- `callback` `<Function>`

## Example:

Expand All @@ -17,6 +20,8 @@ fs.move('/tmp/somefile', '/tmp/does/not/exist/yet/somefile', err => {
})
```

**Using `overwrite` option**

```js
const fs = require('fs-extra')

Expand Down
4 changes: 4 additions & 0 deletions docs/outputFile-sync.md
Expand Up @@ -2,6 +2,10 @@

Almost the same as `writeFileSync` (i.e. it [overwrites](http://pages.citebite.com/v2o5n8l2f5reb)), except that if the parent directory does not exist, it's created. `file` must be a file path (a buffer or a file descriptor is not allowed). `options` are what you'd pass to [`fs.writeFileSync()`](https://nodejs.org/api/fs.html#fs_fs_writefilesync_file_data_options).

- `file` `<String>`
- `data` `<String> | <Buffer> | <Uint8Array>`
- `options` `<Object> | <String>`

## Example:

```js
Expand Down
5 changes: 5 additions & 0 deletions docs/outputFile.md
Expand Up @@ -2,6 +2,11 @@

Almost the same as `writeFile` (i.e. it [overwrites](http://pages.citebite.com/v2o5n8l2f5reb)), except that if the parent directory does not exist, it's created. `file` must be a file path (a buffer or a file descriptor is not allowed). `options` are what you'd pass to [`fs.writeFile()`](https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback).

- `file` `<String>`
- `data` `<String> | <Buffer> | <Uint8Array>`
- `options` `<Object> | <String>`
- `callback` `<Function>`

## Example:

```js
Expand Down
6 changes: 5 additions & 1 deletion docs/outputJson-sync.md
@@ -1,10 +1,14 @@
# outputJsonSync(file, data, [options])
# outputJsonSync(file, object, [options])

Almost the same as [`writeJsonSync`](writeJson-sync.md), except that if the directory does not exist, it's created.
`options` are what you'd pass to [`jsonFile.writeFileSync()`](https://github.com/jprichardson/node-jsonfile#writefilesyncfilename-obj-options).

**Alias:** `outputJSONSync()`

- `file` `<String>`
- `object` `<Object>`
- `options` `<Object>`

## Example:

```js
Expand Down
7 changes: 5 additions & 2 deletions docs/outputJson.md
@@ -1,11 +1,14 @@
# outputJson(file, data, [options], callback)
# outputJson(file, object, [options], callback)

Almost the same as [`writeJson`](writeJson.md), except that if the directory does not exist, it's created.
`options` are what you'd pass to [`jsonFile.writeFile()`](https://github.com/jprichardson/node-jsonfile#writefilefilename-options-callback).

**Alias:** `outputJSON()`

**Sync:** `outputJsonSync()`, `outputJSONSync()`
- `file` `<String>`
- `object` `<Object>`
- `options` `<Object>`
- `callback` `<Function>`

## Example:

Expand Down
3 changes: 3 additions & 0 deletions docs/readJson-sync.md
Expand Up @@ -5,6 +5,9 @@ that you'd pass to [`jsonFile.readFileSync`](https://github.com/jprichardson/nod

**Alias:** `readJSONSync()`

- `file` `<String>`
- `options` `<Object>`

## Example:

```js
Expand Down
4 changes: 4 additions & 0 deletions docs/readJson.md
Expand Up @@ -5,6 +5,10 @@ that you'd pass to [`jsonFile.readFile`](https://github.com/jprichardson/node-js

**Alias:** `readJSON()`

- `file` `<String>`
- `options` `<Object>`
- `callback` `<Function>`

## Example:

```js
Expand Down
2 changes: 2 additions & 0 deletions docs/remove-sync.md
Expand Up @@ -2,6 +2,8 @@

Removes a file or directory. The directory can have contents. Like `rm -rf`.

- `dir` `<String>`

## Example:

```js
Expand Down
3 changes: 3 additions & 0 deletions docs/remove.md
Expand Up @@ -2,6 +2,9 @@

Removes a file or directory. The directory can have contents. Like `rm -rf`.

- `dir` `<String>`
- `callback` `<Function>`

## Example:

```js
Expand Down
4 changes: 4 additions & 0 deletions docs/writeJson-sync.md
Expand Up @@ -5,6 +5,10 @@ you'd pass to [`jsonFile.writeFileSync()`](https://github.com/jprichardson/node-

**Alias:** `writeJSONSync()`

- `file` `<String>`
- `object` `<Object>`
- `options` `<Object>`

## Example:

```js
Expand Down
5 changes: 5 additions & 0 deletions docs/writeJson.md
Expand Up @@ -5,6 +5,11 @@ you'd pass to [`jsonFile.writeFile()`](https://github.com/jprichardson/node-json

**Alias:** `writeJSON()`

- `file` `<String>`
- `object` `<Object>`
- `options` `<Object>`
- `callback` `<Function>`

## Example:

```js
Expand Down

0 comments on commit fc5fca9

Please sign in to comment.