diff options
Diffstat (limited to 'node_modules/fs-extra/docs')
27 files changed, 0 insertions, 777 deletions
diff --git a/node_modules/fs-extra/docs/copy-sync.md b/node_modules/fs-extra/docs/copy-sync.md deleted file mode 100644 index 8e61c2b69..000000000 --- a/node_modules/fs-extra/docs/copy-sync.md +++ /dev/null @@ -1,37 +0,0 @@ -# copySync(src, dest, [options]) - -Copy a file or directory. The directory can have contents. Like `cp -r`. - -- `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: - -```js -const fs = require('fs-extra') - -// copy file -fs.copySync('/tmp/myfile', '/tmp/mynewfile') - -// copy directory, even if it has subdirectories or files -fs.copySync('/tmp/mydir', '/tmp/mynewdir') -``` - -**Using filter function** - -```js -const fs = require('fs-extra') - -const filterFunc = (src, dest) => { - // your logic here - // it will be copied if return true -} - -fs.copySync('/tmp/mydir', '/tmp/mynewdir', { filter: filterFunc }) -``` diff --git a/node_modules/fs-extra/docs/copy.md b/node_modules/fs-extra/docs/copy.md deleted file mode 100644 index 84407261e..000000000 --- a/node_modules/fs-extra/docs/copy.md +++ /dev/null @@ -1,57 +0,0 @@ -# copy(src, dest, [options, callback]) - -Copy a file or directory. The directory can have contents. Like `cp -r`. - -- `src` `<String>` -- `dest` `<String>` Note that if `src` is a file, `dest` cannot be a directory (see [issue #323](https://github.com/jprichardson/node-fs-extra/issues/323)). -- `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: - -```js -const fs = require('fs-extra') - -fs.copy('/tmp/myfile', '/tmp/mynewfile', err => { - if (err) return console.error(err) - - console.log('success!') -}) // copies file - -fs.copy('/tmp/mydir', '/tmp/mynewdir', err => { - if (err) return console.error(err) - - console.log('success!') -}) // copies directory, even if it has subdirectories or files - -// Promise usage: -fs.copy('/tmp/myfile', '/tmp/mynewfile') -.then(() => { - console.log('success!') -}) -.catch(err => { - console.error(err) -}) -``` - -**Using filter function** - -```js -const fs = require('fs-extra') - -const filterFunc = (src, dest) => { - // your logic here - // it will be copied if return true -} - -fs.copy('/tmp/mydir', '/tmp/mynewdir', { filter: filterFunc }, err => { - if (err) return console.error(err) - - console.log('success!') -}) -``` diff --git a/node_modules/fs-extra/docs/emptyDir-sync.md b/node_modules/fs-extra/docs/emptyDir-sync.md deleted file mode 100644 index 7decdbc00..000000000 --- a/node_modules/fs-extra/docs/emptyDir-sync.md +++ /dev/null @@ -1,16 +0,0 @@ -# emptyDirSync(dir) - -Ensures that a directory is empty. Deletes directory contents if the directory is not empty. If the directory does not exist, it is created. The directory itself is not deleted. - -**Alias:** `emptydirSync()` - -- `dir` `<String>` - -## Example: - -```js -const fs = require('fs-extra') - -// assume this directory has a lot of files and folders -fs.emptyDirSync('/tmp/some/dir') -``` diff --git a/node_modules/fs-extra/docs/emptyDir.md b/node_modules/fs-extra/docs/emptyDir.md deleted file mode 100644 index 6553e9a99..000000000 --- a/node_modules/fs-extra/docs/emptyDir.md +++ /dev/null @@ -1,30 +0,0 @@ -# emptyDir(dir, [callback]) - -Ensures that a directory is empty. Deletes directory contents if the directory is not empty. If the directory does not exist, it is created. The directory itself is not deleted. - -**Alias:** `emptydir()` - -- `dir` `<String>` -- `callback` `<Function>` - -## Example: - -```js -const fs = require('fs-extra') - -// assume this directory has a lot of files and folders -fs.emptyDir('/tmp/some/dir', err => { - if (err) return console.error(err) - - console.log('success!') -}) - -// With promises -fs.emptyDir('/tmp/some/dir') -.then(() => { - console.log('success!') -}) -.catch(err => { - console.error(err) -}) -``` diff --git a/node_modules/fs-extra/docs/ensureDir-sync.md b/node_modules/fs-extra/docs/ensureDir-sync.md deleted file mode 100644 index 8f083d278..000000000 --- a/node_modules/fs-extra/docs/ensureDir-sync.md +++ /dev/null @@ -1,17 +0,0 @@ -# ensureDirSync(dir) - -Ensures that the directory exists. If the directory structure does not exist, it is created. Like `mkdir -p`. - -**Aliases:** `mkdirsSync()`, `mkdirpSync()` - -- `dir` `<String>` - -## Example: - -```js -const fs = require('fs-extra') - -const dir = '/tmp/this/path/does/not/exist' -fs.ensureDirSync(dir) -// dir has now been created, including the directory it is to be placed in -``` diff --git a/node_modules/fs-extra/docs/ensureDir.md b/node_modules/fs-extra/docs/ensureDir.md deleted file mode 100644 index d030d8668..000000000 --- a/node_modules/fs-extra/docs/ensureDir.md +++ /dev/null @@ -1,29 +0,0 @@ -# ensureDir(dir, [callback]) - -Ensures that the directory exists. If the directory structure does not exist, it is created. Like `mkdir -p`. - -**Aliases:** `mkdirs()`, `mkdirp()` - -- `dir` `<String>` -- `callback` `<Function>` - -## Example: - -```js -const fs = require('fs-extra') - -const dir = '/tmp/this/path/does/not/exist' -fs.ensureDir(dir, err => { - console.log(err) // => null - // dir has now been created, including the directory it is to be placed in -}) - -// With Promises: -fs.ensureDir(dir) -.then(() => { - console.log('success!') -}) -.catch(err => { - console.error(err) -}) -``` diff --git a/node_modules/fs-extra/docs/ensureFile-sync.md b/node_modules/fs-extra/docs/ensureFile-sync.md deleted file mode 100644 index 25ac39dec..000000000 --- a/node_modules/fs-extra/docs/ensureFile-sync.md +++ /dev/null @@ -1,17 +0,0 @@ -# ensureFileSync(file) - -Ensures that the file exists. If the file that is requested to be created is in directories that do not exist, these directories are created. If the file already exists, it is **NOT MODIFIED**. - -**Alias:** `createFileSync()` - -- `file` `<String>` - -## Example: - -```js -const fs = require('fs-extra') - -const file = '/tmp/this/path/does/not/exist/file.txt' -fs.ensureFileSync(file) -// file has now been created, including the directory it is to be placed in -``` diff --git a/node_modules/fs-extra/docs/ensureFile.md b/node_modules/fs-extra/docs/ensureFile.md deleted file mode 100644 index 987be6389..000000000 --- a/node_modules/fs-extra/docs/ensureFile.md +++ /dev/null @@ -1,29 +0,0 @@ -# ensureFile(file, [callback]) - -Ensures that the file exists. If the file that is requested to be created is in directories that do not exist, these directories are created. If the file already exists, it is **NOT MODIFIED**. - -**Alias:** `createFile()` - -- `file` `<String>` -- `callback` `<Function>` - -## Example: - -```js -const fs = require('fs-extra') - -const file = '/tmp/this/path/does/not/exist/file.txt' -fs.ensureFile(file, err => { - console.log(err) // => null - // file has now been created, including the directory it is to be placed in -}) - -// With Promises: -fs.ensureFile(file) -.then(() => { - console.log('success!') -}) -.catch(err => { - console.error(err) -}) -``` diff --git a/node_modules/fs-extra/docs/ensureLink-sync.md b/node_modules/fs-extra/docs/ensureLink-sync.md deleted file mode 100644 index 74769d30f..000000000 --- a/node_modules/fs-extra/docs/ensureLink-sync.md +++ /dev/null @@ -1,17 +0,0 @@ -# ensureLinkSync(srcpath, dstpath) - -Ensures that the link exists. If the directory structure does not exist, it is created. - -- `srcpath` `<String>` -- `dstpath` `<String>` - -## Example: - -```js -const fs = require('fs-extra') - -const srcpath = '/tmp/file.txt' -const dstpath = '/tmp/this/path/does/not/exist/file.txt' -fs.ensureLinkSync(srcpath, dstpath) -// link has now been created, including the directory it is to be placed in -``` diff --git a/node_modules/fs-extra/docs/ensureLink.md b/node_modules/fs-extra/docs/ensureLink.md deleted file mode 100644 index 90d2a5d6c..000000000 --- a/node_modules/fs-extra/docs/ensureLink.md +++ /dev/null @@ -1,29 +0,0 @@ -# ensureLink(srcpath, dstpath, [callback]) - -Ensures that the link exists. If the directory structure does not exist, it is created. - -- `srcpath` `<String>` -- `dstpath` `<String>` -- `callback` `<Function>` - -## Example: - -```js -const fs = require('fs-extra') - -const srcpath = '/tmp/file.txt' -const dstpath = '/tmp/this/path/does/not/exist/file.txt' -fs.ensureLink(srcpath, dstpath, err => { - console.log(err) // => null - // link has now been created, including the directory it is to be placed in -}) - -// With Promises: -fs.ensureLink(srcpath, dstpath) -.then(() => { - console.log('success!') -}) -.catch(err => { - console.error(err) -}) -``` diff --git a/node_modules/fs-extra/docs/ensureSymlink-sync.md b/node_modules/fs-extra/docs/ensureSymlink-sync.md deleted file mode 100644 index 328d4c45d..000000000 --- a/node_modules/fs-extra/docs/ensureSymlink-sync.md +++ /dev/null @@ -1,18 +0,0 @@ -# ensureSymlinkSync(srcpath, dstpath, [type]) - -Ensures that the symlink exists. If the directory structure does not exist, it is created. - -- `srcpath` `<String>` -- `dstpath` `<String>` -- `type` `<String>` - -## Example: - -```js -const fs = require('fs-extra') - -const srcpath = '/tmp/file.txt' -const dstpath = '/tmp/this/path/does/not/exist/file.txt' -fs.ensureSymlinkSync(srcpath, dstpath) -// symlink has now been created, including the directory it is to be placed in -``` diff --git a/node_modules/fs-extra/docs/ensureSymlink.md b/node_modules/fs-extra/docs/ensureSymlink.md deleted file mode 100644 index 45524f19d..000000000 --- a/node_modules/fs-extra/docs/ensureSymlink.md +++ /dev/null @@ -1,30 +0,0 @@ -# ensureSymlink(srcpath, dstpath, [type, callback]) - -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 -const fs = require('fs-extra') - -const srcpath = '/tmp/file.txt' -const dstpath = '/tmp/this/path/does/not/exist/file.txt' -fs.ensureSymlink(srcpath, dstpath, err => { - console.log(err) // => null - // symlink has now been created, including the directory it is to be placed in -}) - -// With Promises: -fs.ensureSymlink(srcpath, dstpath) -.then(() => { - console.log('success!') -}) -.catch(err => { - console.error(err) -}) -``` diff --git a/node_modules/fs-extra/docs/fs-read-write.md b/node_modules/fs-extra/docs/fs-read-write.md deleted file mode 100644 index 805ea3c38..000000000 --- a/node_modules/fs-extra/docs/fs-read-write.md +++ /dev/null @@ -1,39 +0,0 @@ -# About `fs.read()` & `fs.write()` - -[`fs.read()`](https://nodejs.org/api/fs.html#fs_fs_read_fd_buffer_offset_length_position_callback) & [`fs.write()`](https://nodejs.org/api/fs.html#fs_fs_write_fd_buffer_offset_length_position_callback) are different from other `fs` methods in that their callbacks are called with 3 arguments instead of the usual 2 arguments. - -If you're using them with callbacks, they will behave as usual. However, their promise usage is a little different. `fs-extra` promisifies these methods like [`util.promisify()`](https://nodejs.org/api/util.html#util_util_promisify_original) (only available in Node 8+) does. - -Here's the example promise usage: - -## `fs.read()` - -```js -// Basic promises -fs.read(fd, buffer, offset, length, position) - .then(results => { - console.log(results) - // { bytesRead: 20, buffer: <Buffer 0f 34 5d ...> } - }) - -// Async/await usage: -async function example () { - const { bytesRead, buffer } = await fs.read(fd, Buffer.alloc(length), offset, length, position) -} -``` - -## `fs.write()` - -```js -// Basic promises -fs.write(fd, buffer, offset, length, position) - .then(results => { - console.log(results) - // { bytesWritten: 20, buffer: <Buffer 0f 34 5d ...> } - }) - -// Async/await usage: -async function example () { - const { bytesWritten, buffer } = await fs.write(fd, Buffer.alloc(length), offset, length, position) -} -``` diff --git a/node_modules/fs-extra/docs/move-sync.md b/node_modules/fs-extra/docs/move-sync.md deleted file mode 100644 index cd701fef9..000000000 --- a/node_modules/fs-extra/docs/move-sync.md +++ /dev/null @@ -1,24 +0,0 @@ -# moveSync(src, dest, [options]) - -Moves a file or directory, even across devices. - -- `src` `<String>` -- `dest` `<String>` -- `options` `<Object>` - - `overwrite` `<boolean>`: overwrite existing file or directory, default is `false`. - -## Example: - -```js -const fs = require('fs-extra') - -fs.moveSync('/tmp/somefile', '/tmp/does/not/exist/yet/somefile') -``` - -**Using `overwrite` option** - -```js -const fs = require('fs-extra') - -fs.moveSync('/tmp/somedir', '/tmp/may/already/existed/somedir', { overwrite: true }) -``` diff --git a/node_modules/fs-extra/docs/move.md b/node_modules/fs-extra/docs/move.md deleted file mode 100644 index 0dd210c5b..000000000 --- a/node_modules/fs-extra/docs/move.md +++ /dev/null @@ -1,41 +0,0 @@ -# move(src, dest, [options, callback]) - -Moves a file or directory, even across devices. - -- `src` `<String>` -- `dest` `<String>` -- `options` `<Object>` - - `overwrite` `<boolean>`: overwrite existing file or directory, default is `false`. -- `callback` `<Function>` - -## Example: - -```js -const fs = require('fs-extra') - -fs.move('/tmp/somefile', '/tmp/does/not/exist/yet/somefile', err => { - if (err) return console.error(err) - - console.log('success!') -}) - -fs.move('/tmp/somefile', '/tmp/does/not/exist/yet/somefile') -.then(() => { - console.log('success!') -}) -.catch(err => { - console.error(err) -}) -``` - -**Using `overwrite` option** - -```js -const fs = require('fs-extra') - -fs.move('/tmp/somedir', '/tmp/may/already/existed/somedir', { overwrite: true }, err => { - if (err) return console.error(err) - - console.log('success!') -}) -``` diff --git a/node_modules/fs-extra/docs/outputFile-sync.md b/node_modules/fs-extra/docs/outputFile-sync.md deleted file mode 100644 index 38eee8b6b..000000000 --- a/node_modules/fs-extra/docs/outputFile-sync.md +++ /dev/null @@ -1,19 +0,0 @@ -# outputFileSync(file, data, [options]) - -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 -const fs = require('fs-extra') - -const file = '/tmp/this/path/does/not/exist/file.txt' -fs.outputFileSync(file, 'hello!') - -const data = fs.readFileSync(file, 'utf8') -console.log(data) // => hello! -``` diff --git a/node_modules/fs-extra/docs/outputFile.md b/node_modules/fs-extra/docs/outputFile.md deleted file mode 100644 index 766787d92..000000000 --- a/node_modules/fs-extra/docs/outputFile.md +++ /dev/null @@ -1,34 +0,0 @@ -# outputFile(file, data, [options, callback]) - -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 -const fs = require('fs-extra') - -const file = '/tmp/this/path/does/not/exist/file.txt' -fs.outputFile(file, 'hello!', err => { - console.log(err) // => null - - fs.readFile(file, 'utf8', (err, data) => { - if (err) return console.error(err) - console.log(data) // => hello! - }) -}) - -// With Promises: -fs.outputFile(file, 'hello!') -.then(() => fs.readFile(file, 'utf8')) -.then(data => { - console.log(data) // => hello! -}) -.catch(err => { - console.error(err) -}) -``` diff --git a/node_modules/fs-extra/docs/outputJson-sync.md b/node_modules/fs-extra/docs/outputJson-sync.md deleted file mode 100644 index ef78f802d..000000000 --- a/node_modules/fs-extra/docs/outputJson-sync.md +++ /dev/null @@ -1,25 +0,0 @@ -# outputJsonSync(file, object, [options]) - -Almost the same as [`writeJsonSync`](writeJson-sync.md), except that if the directory does not exist, it's created. - -**Alias:** `outputJSONSync()` - -- `file` `<String>` -- `object` `<Object>` -- `options` `<Object>` - - `spaces` `<Number|String>` Number of spaces to indent; or a string to use for indentation (i.e. pass `'\t'` for tab indentation). See [the docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_space_argument) for more info. - - `EOL` `<String>` Set EOL character. Default is `\n`. - - `replacer` [JSON replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_replacer_parameter) - - Also accepts [`fs.writeFileSync` options](https://nodejs.org/api/fs.html#fs_fs_writefilesync_file_data_options) - -## Example: - -```js -const fs = require('fs-extra') - -const file = '/tmp/this/path/does/not/exist/file.json' -fs.outputJsonSync(file, {name: 'JP'}) - -const data = fs.readJsonSync(file) -console.log(data.name) // => JP -``` diff --git a/node_modules/fs-extra/docs/outputJson.md b/node_modules/fs-extra/docs/outputJson.md deleted file mode 100644 index 7156991e2..000000000 --- a/node_modules/fs-extra/docs/outputJson.md +++ /dev/null @@ -1,40 +0,0 @@ -# outputJson(file, object, [options, callback]) - -Almost the same as [`writeJson`](writeJson.md), except that if the directory does not exist, it's created. - -**Alias:** `outputJSON()` - -- `file` `<String>` -- `object` `<Object>` -- `options` `<Object>` - - `spaces` `<Number|String>` Number of spaces to indent; or a string to use for indentation (i.e. pass `'\t'` for tab indentation). See [the docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_space_argument) for more info. - - `EOL` `<String>` Set EOL character. Default is `\n`. - - `replacer` [JSON replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_replacer_parameter) - - Also accepts [`fs.writeFile` options](https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback) -- `callback` `<Function>` - -## Example: - -```js -const fs = require('fs-extra') - -const file = '/tmp/this/path/does/not/exist/file.json' -fs.outputJson(file, {name: 'JP'}, err => { - console.log(err) // => null - - fs.readJson(file, (err, data) => { - if (err) return console.error(err) - console.log(data.name) // => JP - }) -}) - -// With Promises: -fs.outputJson(file, {name: 'JP'}) -.then(() => fs.readJson(file)) -.then(data => { - console.log(data.name) // => JP -}) -.catch(err => { - console.error(err) -}) -``` diff --git a/node_modules/fs-extra/docs/pathExists-sync.md b/node_modules/fs-extra/docs/pathExists-sync.md deleted file mode 100644 index 3ef973c21..000000000 --- a/node_modules/fs-extra/docs/pathExists-sync.md +++ /dev/null @@ -1,3 +0,0 @@ -# pathExistsSync(file) - -An alias for [`fs.existsSync()`](https://nodejs.org/api/fs.html#fs_fs_existssync_path), created for consistency with [`pathExists()`](pathExists.md). diff --git a/node_modules/fs-extra/docs/pathExists.md b/node_modules/fs-extra/docs/pathExists.md deleted file mode 100644 index 0302b09de..000000000 --- a/node_modules/fs-extra/docs/pathExists.md +++ /dev/null @@ -1,22 +0,0 @@ -# pathExists(file[, callback]) - -Test whether or not the given path exists by checking with the file system. Like [`fs.exists`](https://nodejs.org/api/fs.html#fs_fs_exists_path_callback), but with a normal callback signature (err, exists). Uses `fs.access` under the hood. - -- `file` `<String>` -- `callback` `<Function>` - -## Example: - -```js -const fs = require('fs-extra') - -const file = '/tmp/this/path/does/not/exist/file.txt' -// Promise usage: -fs.pathExists(file) - .then(exists => console.log(exists)) // => false -// Callback usage: -fs.pathExists(file, (err, exists) => { - console.log(err) // => null - console.log(exists) // => false -}) -``` diff --git a/node_modules/fs-extra/docs/readJson-sync.md b/node_modules/fs-extra/docs/readJson-sync.md deleted file mode 100644 index a1356379c..000000000 --- a/node_modules/fs-extra/docs/readJson-sync.md +++ /dev/null @@ -1,33 +0,0 @@ -# readJsonSync(file, [options]) - -Reads a JSON file and then parses it into an object. `options` are the same -that you'd pass to [`jsonFile.readFileSync`](https://github.com/jprichardson/node-jsonfile#readfilesyncfilename-options). - -**Alias:** `readJSONSync()` - -- `file` `<String>` -- `options` `<Object>` - -## Example: - -```js -const fs = require('fs-extra') - -const packageObj = fs.readJsonSync('./package.json') -console.log(packageObj.version) // => 2.0.0 -``` - ---- - -`readJsonSync()` can take a `throws` option set to `false` and it won't throw if the JSON is invalid. Example: - -```js -const fs = require('fs-extra') - -const file = '/tmp/some-invalid.json' -const data = '{not valid JSON' -fs.writeFileSync(file, data) - -const obj = fs.readJsonSync(file, { throws: false }) -console.log(obj) // => null -``` diff --git a/node_modules/fs-extra/docs/readJson.md b/node_modules/fs-extra/docs/readJson.md deleted file mode 100644 index 6edc329d5..000000000 --- a/node_modules/fs-extra/docs/readJson.md +++ /dev/null @@ -1,58 +0,0 @@ -# readJson(file, [options, callback]) - -Reads a JSON file and then parses it into an object. `options` are the same -that you'd pass to [`jsonFile.readFile`](https://github.com/jprichardson/node-jsonfile#readfilefilename-options-callback). - -**Alias:** `readJSON()` - -- `file` `<String>` -- `options` `<Object>` -- `callback` `<Function>` - -## Example: - -```js -const fs = require('fs-extra') - -fs.readJson('./package.json', (err, packageObj) => { - if (err) console.error(err) - - console.log(packageObj.version) // => 0.1.3 -}) - -// Promise Usage -fs.readJson('./package.json') -.then(packageObj => { - console.log(packageObj.version) // => 0.1.3 -}) -.catch(err => { - console.error(err) -}) -``` - ---- - -`readJson()` can take a `throws` option set to `false` and it won't throw if the JSON is invalid. Example: - -```js -const fs = require('fs-extra') - -const file = '/tmp/some-invalid.json' -const data = '{not valid JSON' -fs.writeFileSync(file, data) - -fs.readJson(file, { throws: false }, (err, obj) => { - if (err) console.error(err) - - console.log(obj) // => null -}) - -// Promise Usage -fs.readJson(file, { throws: false }) -.then(obj => { - console.log(obj) // => null -}) -.catch(err => { - console.error(err) // Not called -}) -``` diff --git a/node_modules/fs-extra/docs/remove-sync.md b/node_modules/fs-extra/docs/remove-sync.md deleted file mode 100644 index fb01fe821..000000000 --- a/node_modules/fs-extra/docs/remove-sync.md +++ /dev/null @@ -1,16 +0,0 @@ -# removeSync(path) - -Removes a file or directory. The directory can have contents. Like `rm -rf`. - -- `path` `<String>` - -## Example: - -```js -const fs = require('fs-extra') - -// remove file -fs.removeSync('/tmp/myfile') - -fs.removeSync('/home/jprichardson') // I just deleted my entire HOME directory. -``` diff --git a/node_modules/fs-extra/docs/remove.md b/node_modules/fs-extra/docs/remove.md deleted file mode 100644 index 364029351..000000000 --- a/node_modules/fs-extra/docs/remove.md +++ /dev/null @@ -1,34 +0,0 @@ -# remove(path, [callback]) - -Removes a file or directory. The directory can have contents. Like `rm -rf`. - -- `path` `<String>` -- `callback` `<Function>` - -## Example: - -```js -const fs = require('fs-extra') - -// remove file -fs.remove('/tmp/myfile', err => { - if (err) return console.error(err) - - console.log('success!') -}) - -fs.remove('/home/jprichardson', err => { - if (err) return console.error(err) - - console.log('success!') // I just deleted my entire HOME directory. -}) - -// Promise Usage -fs.remove('/tmp/myfile') -.then(() => { - console.log('success!') -}) -.catch(err => { - console.error(err) -}) -``` diff --git a/node_modules/fs-extra/docs/writeJson-sync.md b/node_modules/fs-extra/docs/writeJson-sync.md deleted file mode 100644 index c22459db8..000000000 --- a/node_modules/fs-extra/docs/writeJson-sync.md +++ /dev/null @@ -1,24 +0,0 @@ -# writeJsonSync(file, object, [options]) - -Writes an object to a JSON file. - -**Alias:** `writeJSONSync()` - -- `file` `<String>` -- `object` `<Object>` -- `options` `<Object>` - - `spaces` `<Number|String>` Number of spaces to indent; or a string to use for indentation (i.e. pass `'\t'` for tab indentation). See [the docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_space_argument) for more info. - - `EOL` `<String>` Set EOL character. Default is `\n`. - - `replacer` [JSON replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_replacer_parameter) - - Also accepts [`fs.writeFileSync` options](https://nodejs.org/api/fs.html#fs_fs_writefilesync_file_data_options) - -## Example: - -```js -const fs = require('fs-extra') - -fs.writeJsonSync('./package.json', {name: 'fs-extra'}) -``` ---- - -**See also:** [`outputJsonSync()`](outputJson-sync.md) diff --git a/node_modules/fs-extra/docs/writeJson.md b/node_modules/fs-extra/docs/writeJson.md deleted file mode 100644 index 8e35271fb..000000000 --- a/node_modules/fs-extra/docs/writeJson.md +++ /dev/null @@ -1,39 +0,0 @@ -# writeJson(file, object, [options, callback]) - -Writes an object to a JSON file. - -**Alias:** `writeJSON()` - -- `file` `<String>` -- `object` `<Object>` -- `options` `<Object>` - - `spaces` `<Number|String>` Number of spaces to indent; or a string to use for indentation (i.e. pass `'\t'` for tab indentation). See [the docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_space_argument) for more info. - - `EOL` `<String>` Set EOL character. Default is `\n`. - - `replacer` [JSON replacer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#The_replacer_parameter) - - Also accepts [`fs.writeFile` options](https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback) -- `callback` `<Function>` - -## Example: - -```js -const fs = require('fs-extra') - -fs.writeJson('./package.json', {name: 'fs-extra'}, err => { - if (err) return console.error(err) - - console.log('success!') -}) - -// With Promises -fs.writeJson('./package.json', {name: 'fs-extra'}) -.then(() => { - console.log('success!') -}) -.catch(err => { - console.error(err) -}) -``` - ---- - -**See also:** [`outputJson()`](outputJson.md) |