mirror of
https://github.com/bakustarver/rpgmakermlinux-cicpoffs.git
synced 2025-04-29 19:44:52 +02:00
Add files via upload
This commit is contained in:
parent
1691a9c72f
commit
a5389c8738
28 changed files with 1036 additions and 0 deletions
37
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/copy-sync.md
generated
vendored
Normal file
37
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/copy-sync.md
generated
vendored
Normal file
|
@ -0,0 +1,37 @@
|
|||
# copySync(src, dest[, options])
|
||||
|
||||
Copy a file or directory. The directory can have contents.
|
||||
|
||||
- `src` `<String>` Note that if `src` is a directory it will copy everything inside of this directory, not the entire directory itself (see [issue #537](https://github.com/jprichardson/node-fs-extra/issues/537)).
|
||||
- `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>`: When true, will set last modification and access times to the ones of the original source files. When false, timestamp behavior is OS-dependent. Default is `false`.
|
||||
- `filter` `<Function>`: Function to filter copied files/directories. Return `true` to copy the item, `false` to ignore it.
|
||||
|
||||
## 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 })
|
||||
```
|
68
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/copy.md
generated
vendored
Normal file
68
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/copy.md
generated
vendored
Normal file
|
@ -0,0 +1,68 @@
|
|||
# copy(src, dest[, options][, callback])
|
||||
|
||||
Copy a file or directory. The directory can have contents.
|
||||
|
||||
- `src` `<String>` Note that if `src` is a directory it will copy everything inside of this directory, not the entire directory itself (see [issue #537](https://github.com/jprichardson/node-fs-extra/issues/537)).
|
||||
- `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>`: When true, will set last modification and access times to the ones of the original source files. When false, timestamp behavior is OS-dependent. Default is `false`.
|
||||
- `filter` `<Function>`: Function to filter copied files/directories. Return `true` to copy the item, `false` to ignore it. Can also return a `Promise` that resolves to `true` or `false` (or pass in an `async` function).
|
||||
- `callback` `<Function>`
|
||||
- `err` `<Error>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
// With a callback:
|
||||
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
|
||||
|
||||
// With Promises:
|
||||
fs.copy('/tmp/myfile', '/tmp/mynewfile')
|
||||
.then(() => {
|
||||
console.log('success!')
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
|
||||
// With async/await:
|
||||
async function example () {
|
||||
try {
|
||||
await fs.copy('/tmp/myfile', '/tmp/mynewfile')
|
||||
console.log('success!')
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
|
||||
example()
|
||||
```
|
||||
|
||||
**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!')
|
||||
})
|
||||
```
|
16
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/emptyDir-sync.md
generated
vendored
Normal file
16
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/emptyDir-sync.md
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
# 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')
|
||||
```
|
43
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/emptyDir.md
generated
vendored
Normal file
43
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/emptyDir.md
generated
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
# 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>`
|
||||
- `err` `<Error>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
// assume this directory has a lot of files and folders
|
||||
// With a callback:
|
||||
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)
|
||||
})
|
||||
|
||||
// With async/await:
|
||||
async function example () {
|
||||
try {
|
||||
await fs.emptyDir('/tmp/some/dir')
|
||||
console.log('success!')
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
|
||||
example()
|
||||
```
|
32
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/ensureDir-sync.md
generated
vendored
Normal file
32
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/ensureDir-sync.md
generated
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
# ensureDirSync(dir[,options])
|
||||
|
||||
Ensures that the directory exists. If the directory structure does not exist, it is created. If provided, options may specify the desired mode for the directory.
|
||||
|
||||
**Aliases:** `mkdirsSync()`, `mkdirpSync()`
|
||||
|
||||
- `dir` `<String>`
|
||||
- `options` `<Integer> | <Object>`
|
||||
- If it is `Integer`, it will be `mode`.
|
||||
- If it is `Object`, it will be `{ mode: <Integer> }`.
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
const dir = '/tmp/this/path/does/not/exist'
|
||||
|
||||
const desiredMode = 0o2775
|
||||
const options = {
|
||||
mode: 0o2775
|
||||
}
|
||||
|
||||
fs.ensureDirSync(dir)
|
||||
// dir has now been created, including the directory it is to be placed in
|
||||
|
||||
fs.ensureDirSync(dir, desiredMode)
|
||||
// dir has now been created, including the directory it is to be placed in with permission 0o2775
|
||||
|
||||
fs.ensureDirSync(dir, options)
|
||||
// dir has now been created, including the directory it is to be placed in with permission 0o2775
|
||||
```
|
76
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/ensureDir.md
generated
vendored
Normal file
76
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/ensureDir.md
generated
vendored
Normal file
|
@ -0,0 +1,76 @@
|
|||
# ensureDir(dir[,options][,callback])
|
||||
|
||||
Ensures that the directory exists. If the directory structure does not exist, it is created.
|
||||
|
||||
**Aliases:** `mkdirs()`, `mkdirp()`
|
||||
|
||||
- `dir` `<String>`
|
||||
- `options` `<Integer> | <Object>`
|
||||
- If it is `Integer`, it will be `mode`.
|
||||
- If it is `Object`, it will be `{ mode: <Integer> }`.
|
||||
- `callback` `<Function>`
|
||||
- `err` `<Error>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
const dir = '/tmp/this/path/does/not/exist'
|
||||
const desiredMode = 0o2775
|
||||
const options = {
|
||||
mode: 0o2775
|
||||
}
|
||||
|
||||
// With a callback:
|
||||
fs.ensureDir(dir, err => {
|
||||
console.log(err) // => null
|
||||
// dir has now been created, including the directory it is to be placed in
|
||||
})
|
||||
|
||||
// With a callback and a mode integer
|
||||
fs.ensureDir(dir, desiredMode, err => {
|
||||
console.log(err) // => null
|
||||
// dir has now been created with mode 0o2775, including the directory it is to be placed in
|
||||
})
|
||||
|
||||
// With Promises:
|
||||
fs.ensureDir(dir)
|
||||
.then(() => {
|
||||
console.log('success!')
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
|
||||
// With Promises and a mode integer:
|
||||
fs.ensureDir(dir, desiredMode)
|
||||
.then(() => {
|
||||
console.log('success!')
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
|
||||
// With async/await:
|
||||
async function example (directory) {
|
||||
try {
|
||||
await fs.ensureDir(directory)
|
||||
console.log('success!')
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
example(dir)
|
||||
|
||||
// With async/await and an options object, containing mode:
|
||||
async function exampleMode (directory) {
|
||||
try {
|
||||
await fs.ensureDir(directory, options)
|
||||
console.log('success!')
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
exampleMode(dir)
|
||||
```
|
17
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/ensureFile-sync.md
generated
vendored
Normal file
17
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/ensureFile-sync.md
generated
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
# 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
|
||||
```
|
44
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/ensureFile.md
generated
vendored
Normal file
44
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/ensureFile.md
generated
vendored
Normal file
|
@ -0,0 +1,44 @@
|
|||
# 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>`
|
||||
- `err` `<Error>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
const file = '/tmp/this/path/does/not/exist/file.txt'
|
||||
|
||||
// With a callback:
|
||||
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)
|
||||
})
|
||||
|
||||
// With async/await:
|
||||
async function example (f) {
|
||||
try {
|
||||
await fs.ensureFile(f)
|
||||
console.log('success!')
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
|
||||
example(file)
|
||||
```
|
19
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/ensureLink-sync.md
generated
vendored
Normal file
19
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/ensureLink-sync.md
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
# ensureLinkSync(srcPath, destPath)
|
||||
|
||||
Ensures that the link exists. If the directory structure does not exist, it is created.
|
||||
|
||||
**Alias:** `createLinkSync()`
|
||||
|
||||
- `srcPath` `<String>`
|
||||
- `destPath` `<String>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
const srcPath = '/tmp/file.txt'
|
||||
const destPath = '/tmp/this/path/does/not/exist/file.txt'
|
||||
fs.ensureLinkSync(srcPath, destPath)
|
||||
// link has now been created, including the directory it is to be placed in
|
||||
```
|
46
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/ensureLink.md
generated
vendored
Normal file
46
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/ensureLink.md
generated
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
# ensureLink(srcPath, destPath[, callback])
|
||||
|
||||
Ensures that the link exists. If the directory structure does not exist, it is created.
|
||||
|
||||
**Alias:** `createLink()`
|
||||
|
||||
- `srcPath` `<String>`
|
||||
- `destPath` `<String>`
|
||||
- `callback` `<Function>`
|
||||
- `err` `<Error>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
const srcPath = '/tmp/file.txt'
|
||||
const destPath = '/tmp/this/path/does/not/exist/file.txt'
|
||||
|
||||
// With a callback:
|
||||
fs.ensureLink(srcPath, destPath, err => {
|
||||
console.log(err) // => null
|
||||
// link has now been created, including the directory it is to be placed in
|
||||
})
|
||||
|
||||
// With Promises:
|
||||
fs.ensureLink(srcPath, destPath)
|
||||
.then(() => {
|
||||
console.log('success!')
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
|
||||
// With async/await:
|
||||
async function example (src, dest) {
|
||||
try {
|
||||
await fs.ensureLink(src, dest)
|
||||
console.log('success!')
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
|
||||
example(srcPath, destPath)
|
||||
```
|
20
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/ensureSymlink-sync.md
generated
vendored
Normal file
20
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/ensureSymlink-sync.md
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
# ensureSymlinkSync(srcPath, destPath[, type])
|
||||
|
||||
Ensures that the symlink exists. If the directory structure does not exist, it is created.
|
||||
|
||||
**Alias:** `createSymlinkSync()`
|
||||
|
||||
- `srcPath` `<String>`
|
||||
- `destPath` `<String>`
|
||||
- `type` `<String>` It is only available on Windows and ignored on other platforms. It can be set to `dir`, `file`, or `junction`.
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
const srcPath = '/tmp/file.txt'
|
||||
const destPath = '/tmp/this/path/does/not/exist/file.txt'
|
||||
fs.ensureSymlinkSync(srcPath, destPath)
|
||||
// symlink has now been created, including the directory it is to be placed in
|
||||
```
|
47
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/ensureSymlink.md
generated
vendored
Normal file
47
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/ensureSymlink.md
generated
vendored
Normal file
|
@ -0,0 +1,47 @@
|
|||
# ensureSymlink(srcPath, destPath[, type][, callback])
|
||||
|
||||
Ensures that the symlink exists. If the directory structure does not exist, it is created.
|
||||
|
||||
**Alias:** `createSymlink()`
|
||||
|
||||
- `srcPath` `<String>`
|
||||
- `destPath` `<String>`
|
||||
- `type` `<String>` It is only available on Windows and ignored on other platforms. It can be set to `dir`, `file`, or `junction`.
|
||||
- `callback` `<Function>`
|
||||
- `err` `<Error>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
const srcPath = '/tmp/file.txt'
|
||||
const destPath = '/tmp/this/path/does/not/exist/file.txt'
|
||||
|
||||
// With a callback:
|
||||
fs.ensureSymlink(srcPath, destPath, err => {
|
||||
console.log(err) // => null
|
||||
// symlink has now been created, including the directory it is to be placed in
|
||||
})
|
||||
|
||||
// With Promises:
|
||||
fs.ensureSymlink(srcPath, destPath)
|
||||
.then(() => {
|
||||
console.log('success!')
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
|
||||
// With async/await:
|
||||
async function example (src, dest) {
|
||||
try {
|
||||
await fs.ensureSymlink(src, dest)
|
||||
console.log('success!')
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
|
||||
example(srcPath, destPath)
|
||||
```
|
48
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/fs-read-write-writev.md
generated
vendored
Normal file
48
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/fs-read-write-writev.md
generated
vendored
Normal file
|
@ -0,0 +1,48 @@
|
|||
# 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), & [`fs.writev()`](https://nodejs.org/api/fs.html#fs_fs_writev_fd_buffers_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
|
||||
// With Promises:
|
||||
fs.read(fd, buffer, offset, length, position)
|
||||
.then(results => {
|
||||
console.log(results)
|
||||
// { bytesRead: 20, buffer: <Buffer 0f 34 5d ...> }
|
||||
})
|
||||
|
||||
// With async/await:
|
||||
async function example () {
|
||||
const { bytesRead, buffer } = await fs.read(fd, Buffer.alloc(length), offset, length, position)
|
||||
}
|
||||
```
|
||||
|
||||
## `fs.write()`
|
||||
|
||||
```js
|
||||
// With Promises:
|
||||
fs.write(fd, buffer, offset, length, position)
|
||||
.then(results => {
|
||||
console.log(results)
|
||||
// { bytesWritten: 20, buffer: <Buffer 0f 34 5d ...> }
|
||||
})
|
||||
|
||||
// With async/await:
|
||||
async function example () {
|
||||
const { bytesWritten, buffer } = await fs.write(fd, Buffer.alloc(length), offset, length, position)
|
||||
}
|
||||
```
|
||||
|
||||
## `fs.writev()`
|
||||
|
||||
```js
|
||||
// With async/await:
|
||||
async function example () {
|
||||
const { bytesWritten, buffers } = await fs.writev(fd, buffers, position)
|
||||
}
|
||||
```
|
24
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/move-sync.md
generated
vendored
Normal file
24
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/move-sync.md
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
# moveSync(src, dest[, options])
|
||||
|
||||
Moves a file or directory, even across devices.
|
||||
|
||||
- `src` `<String>`
|
||||
- `dest` `<String>` Note: When `src` is a file, `dest` must be a file and when `src` is a directory, `dest` must be a directory.
|
||||
- `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/exist/somedir', { overwrite: true })
|
||||
```
|
57
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/move.md
generated
vendored
Normal file
57
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/move.md
generated
vendored
Normal file
|
@ -0,0 +1,57 @@
|
|||
# move(src, dest[, options][, callback])
|
||||
|
||||
Moves a file or directory, even across devices.
|
||||
|
||||
- `src` `<String>`
|
||||
- `dest` `<String>` Note: When `src` is a file, `dest` must be a file and when `src` is a directory, `dest` must be a directory.
|
||||
- `options` `<Object>`
|
||||
- `overwrite` `<boolean>`: overwrite existing file or directory, default is `false`.
|
||||
- `callback` `<Function>`
|
||||
- `err` `<Error>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
const src = '/tmp/file.txt'
|
||||
const dest = '/tmp/this/path/does/not/exist/file.txt'
|
||||
|
||||
// With a callback:
|
||||
fs.move(src, dest, err => {
|
||||
if (err) return console.error(err)
|
||||
console.log('success!')
|
||||
})
|
||||
|
||||
// With Promises:
|
||||
fs.move(src, dest)
|
||||
.then(() => {
|
||||
console.log('success!')
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
|
||||
// With async/await:
|
||||
async function example (src, dest) {
|
||||
try {
|
||||
await fs.move(src, dest)
|
||||
console.log('success!')
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
|
||||
example(src, dest)
|
||||
```
|
||||
|
||||
**Using `overwrite` option**
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
fs.move('/tmp/somedir', '/tmp/may/already/exist/somedir', { overwrite: true }, err => {
|
||||
if (err) return console.error(err)
|
||||
console.log('success!')
|
||||
})
|
||||
```
|
19
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/outputFile-sync.md
generated
vendored
Normal file
19
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/outputFile-sync.md
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
# outputFileSync(file, data[, options])
|
||||
|
||||
Almost the same as `writeFileSync` (i.e. it overwrites), 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).
|
||||
|
||||
- `file` `<String>`
|
||||
- `data` `<String> | <Buffer> | <Uint8Array>`
|
||||
- `options` `<Object> | <String>` (the same as [`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.txt'
|
||||
fs.outputFileSync(file, 'hello!')
|
||||
|
||||
const data = fs.readFileSync(file, 'utf8')
|
||||
console.log(data) // => hello!
|
||||
```
|
52
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/outputFile.md
generated
vendored
Normal file
52
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/outputFile.md
generated
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
# outputFile(file, data[, options][, callback])
|
||||
|
||||
Almost the same as `writeFile` (i.e. it overwrites), 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).
|
||||
|
||||
- `file` `<String>`
|
||||
- `data` `<String> | <Buffer> | <Uint8Array>`
|
||||
- `options` `<Object> | <String>` (the same as [`fs.writeFile()` options](https://nodejs.org/api/fs.html#fs_fs_writefile_file_data_options_callback))
|
||||
- `callback` `<Function>`
|
||||
- `err` `<Error>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
const file = '/tmp/this/path/does/not/exist/file.txt'
|
||||
|
||||
// With a callback:
|
||||
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)
|
||||
})
|
||||
|
||||
// With async/await:
|
||||
async function example (f) {
|
||||
try {
|
||||
await fs.outputFile(f, 'hello!')
|
||||
|
||||
const data = await fs.readFile(f, 'utf8')
|
||||
|
||||
console.log(data) // => hello!
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
|
||||
example(file)
|
||||
```
|
25
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/outputJson-sync.md
generated
vendored
Normal file
25
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/outputJson-sync.md
generated
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
# 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
|
||||
```
|
58
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/outputJson.md
generated
vendored
Normal file
58
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/outputJson.md
generated
vendored
Normal file
|
@ -0,0 +1,58 @@
|
|||
# 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>`
|
||||
- `err` `<Error>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
const file = '/tmp/this/path/does/not/exist/file.json'
|
||||
|
||||
// With a callback:
|
||||
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)
|
||||
})
|
||||
|
||||
// With async/await:
|
||||
async function example (f) {
|
||||
try {
|
||||
await fs.outputJson(f, {name: 'JP'})
|
||||
|
||||
const data = await fs.readJson(f)
|
||||
|
||||
console.log(data.name) // => JP
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
|
||||
example(file)
|
||||
```
|
3
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/pathExists-sync.md
generated
vendored
Normal file
3
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/pathExists-sync.md
generated
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
# pathExistsSync(file)
|
||||
|
||||
An alias for [`fs.existsSync()`](https://nodejs.org/api/fs.html#fs_fs_existssync_path), created for consistency with [`pathExists()`](pathExists.md).
|
35
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/pathExists.md
generated
vendored
Normal file
35
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/pathExists.md
generated
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
# 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>`
|
||||
- `err` `<Error>`
|
||||
- `exists` `<boolean>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
const file = '/tmp/this/path/does/not/exist/file.txt'
|
||||
|
||||
// With a callback:
|
||||
fs.pathExists(file, (err, exists) => {
|
||||
console.log(err) // => null
|
||||
console.log(exists) // => false
|
||||
})
|
||||
|
||||
// Promise usage:
|
||||
fs.pathExists(file)
|
||||
.then(exists => console.log(exists)) // => false
|
||||
|
||||
// With async/await:
|
||||
async function example (f) {
|
||||
const exists = await fs.pathExists(f)
|
||||
|
||||
console.log(exists) // => false
|
||||
}
|
||||
|
||||
example(file)
|
||||
```
|
32
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/readJson-sync.md
generated
vendored
Normal file
32
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/readJson-sync.md
generated
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
# readJsonSync(file[, options])
|
||||
|
||||
Reads a JSON file and then parses it into an object.
|
||||
|
||||
**Alias:** `readJSONSync()`
|
||||
|
||||
- `file` `<String>`
|
||||
- `options` `<Object>` (the same as [`jsonFile.readFileSync()` options](https://github.com/jprichardson/node-jsonfile#readfilesyncfilename-options))
|
||||
|
||||
## 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
|
||||
```
|
79
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/readJson.md
generated
vendored
Normal file
79
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/readJson.md
generated
vendored
Normal file
|
@ -0,0 +1,79 @@
|
|||
# readJson(file[, options][, callback])
|
||||
|
||||
Reads a JSON file and then parses it into an object.
|
||||
|
||||
**Alias:** `readJSON()`
|
||||
|
||||
- `file` `<String>`
|
||||
- `options` `<Object>` (the same as [`jsonFile.readFile()` options](https://github.com/jprichardson/node-jsonfile#readfilefilename-options-callback))
|
||||
- `callback` `<Function>`
|
||||
- `err` `<Error>`
|
||||
- `obj` `<Object>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
// With a callback:
|
||||
fs.readJson('./package.json', (err, packageObj) => {
|
||||
if (err) console.error(err)
|
||||
console.log(packageObj.version) // => 0.1.3
|
||||
})
|
||||
|
||||
// With Promises:
|
||||
fs.readJson('./package.json')
|
||||
.then(packageObj => {
|
||||
console.log(packageObj.version) // => 0.1.3
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
|
||||
// With async/await:
|
||||
async function example () {
|
||||
try {
|
||||
const packageObj = await fs.readJson('./package.json')
|
||||
console.log(packageObj.version) // => 0.1.3
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
|
||||
example()
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
`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)
|
||||
|
||||
// With a callback:
|
||||
fs.readJson(file, { throws: false }, (err, obj) => {
|
||||
if (err) console.error(err)
|
||||
console.log(obj) // => null
|
||||
})
|
||||
|
||||
// With Promises:
|
||||
fs.readJson(file, { throws: false })
|
||||
.then(obj => {
|
||||
console.log(obj) // => null
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err) // Not called
|
||||
})
|
||||
|
||||
// With async/await:
|
||||
async function example (f) {
|
||||
const obj = await fs.readJson(f, { throws: false })
|
||||
console.log(obj) // => null
|
||||
}
|
||||
|
||||
example(file)
|
||||
```
|
16
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/remove-sync.md
generated
vendored
Normal file
16
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/remove-sync.md
generated
vendored
Normal file
|
@ -0,0 +1,16 @@
|
|||
# removeSync(path)
|
||||
|
||||
Removes a file or directory. The directory can have contents. If the path does not exist, silently does nothing.
|
||||
|
||||
- `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.
|
||||
```
|
46
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/remove.md
generated
vendored
Normal file
46
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/remove.md
generated
vendored
Normal file
|
@ -0,0 +1,46 @@
|
|||
# remove(path[, callback])
|
||||
|
||||
Removes a file or directory. The directory can have contents. If the path does not exist, silently does nothing.
|
||||
|
||||
- `path` `<String>`
|
||||
- `callback` `<Function>`
|
||||
- `err` `<Error>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
// remove file
|
||||
// With a callback:
|
||||
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.
|
||||
})
|
||||
|
||||
// With Promises:
|
||||
fs.remove('/tmp/myfile')
|
||||
.then(() => {
|
||||
console.log('success!')
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
|
||||
// With async/await:
|
||||
async function example (src, dest) {
|
||||
try {
|
||||
await fs.remove('/tmp/myfile')
|
||||
console.log('success!')
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
|
||||
example()
|
||||
```
|
24
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/writeJson-sync.md
generated
vendored
Normal file
24
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/writeJson-sync.md
generated
vendored
Normal file
|
@ -0,0 +1,24 @@
|
|||
# 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)
|
52
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/writeJson.md
generated
vendored
Normal file
52
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/docs/writeJson.md
generated
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
# 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>`
|
||||
- `err` `<Error>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
// With a callback:
|
||||
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)
|
||||
})
|
||||
|
||||
// With async/await:
|
||||
async function example () {
|
||||
try {
|
||||
await fs.writeJson('./package.json', {name: 'fs-extra'})
|
||||
console.log('success!')
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
}
|
||||
}
|
||||
|
||||
example()
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
**See also:** [`outputJson()`](outputJson.md)
|
1
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/test/readme.md
generated
vendored
Normal file
1
nwjs/packagefiles/tyranobuilder/node_modules/fs-extra/test/readme.md
generated
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
Looking for the test files? You can find all of the test files in `lib/**/__tests__`.
|
Loading…
Add table
Reference in a new issue