Namespace: fsn/nextra

fsn/nextra

Source:
index.js#L1

Methods


<static> copy(source, destination [, options])

Copies files from one location to another, creating all directories required to satisfy the destination path. source and destination paths.
Parameters:
Name Type Argument Default Description
source string The source path
destination string The destination path
options CopyOptions | function <optional>
{} Options for the copy, or a filter function
Source:
nextra/copy.js#L18
Returns:
Type
Promise.<void>

<static> copyFileAtomic(source, destination [, options])

Parameters:
Name Type Argument Description
source string The path to the file you want to copy
destination string The path to the file destination
options WriteOptions | string <optional>
The write options or the encoding string.
Source:
nextra/copyFileAtomic.js#L6
Returns:
Type
Promise.<void>

<static> createFile(file [, atomic])

Creates an empty file, making all folders required to satisfy the given file path.
Parameters:
Name Type Argument Default Description
file string Path of the file you want to create
atomic boolean <optional>
false Whether the operation should run atomically
Source:
nextra/createFile.js#L17
Returns:
Type
Promise.<void>

<static> createFileAtomic(file)

Creates an file copy, making all folders required to satisfy the given file path atomically.
Parameters:
Name Type Description
file string Path of the file you want to create
Source:
nextra/createFileAtomic.js#L10
Returns:
Type
Promise.<void>

<static> createFileCopy(source, destination [, options] [, atomic])

Creates an file copy, making all folders required to satisfy the given file path.
Parameters:
Name Type Argument Default Description
source string The path to the file you want to copy
destination string The path to the file destination
options WriteOptions | string <optional>
The write options or the encoding string.
atomic boolean <optional>
false Whether the operation should run atomically
Source:
nextra/createFileCopy.js#L18
Returns:
Type
Promise.<void>

<static> createFileCopyAtomic(source, destination [, options])

Creates a file copy atomically, making all folders required to satisfy the given file path.
Parameters:
Name Type Argument Description
source string The path to the file you want to copy
destination string The path to the file destination
options WriteOptions | string <optional>
The write options or the encoding string.
Source:
nextra/createFileCopyAtomic.js#L12
Returns:
Type
Promise.<void>

Creates a hard file link, making all folders required to satisfy the given file path.
Parameters:
Name Type Argument Default Description
source string The source path of the file
destination string The destination path of the file
atomic boolean <optional>
false Whether the operation should run atomically
Source:
nextra/createLink.js#L18
Returns:
Type
Promise.<void>

<static> createLinkAtomic(source, destination)

Creates a hard file link, making all folders required to satisfy the given file path atomically.
Parameters:
Name Type Description
source string The source path of the file
destination string The destination path of the file
Source:
nextra/createLinkAtomic.js#L11
Returns:
Type
Promise.<void>

Creates a soft file link, making all folders required to satisfy the given file path.
Parameters:
Name Type Argument Default Description
source string The source path of the file
destination string The destination path of the file
type SymLinkType <optional>
The type of symlink you are creating
atomic boolean <optional>
false Whether the operation should run atomically
Source:
nextra/createSymlink.js#L18
Returns:
Type
Promise.<void>

<static> createSymlinkAtomic(source, destination [, type])

Creates a soft file link, making all folders required to satisfy the given file path atomically.
Parameters:
Name Type Argument Description
source string The source path of the file
destination string The destination path of the file
type SymLinkType <optional>
The type of symlink you are creating
Source:
nextra/createSymlinkAtomic.js#L12
Returns:
Type
Promise.<void>

<static> emptyDir(dir)

Deletes all directories and files within the provided directory.
Parameters:
Name Type Description
dir string The directory you wish to empty
Source:
nextra/emptyDir.js#L15

<static> emptydir(dir)

Deletes all directories and files within the provided directory.
Parameters:
Name Type Description
dir string The directory you wish to empty
Source:
nextra/emptyDir.js#L8
Returns:
Type
Promise.<void>

<static> ensureDir(path [, options])

Recursively makes directories, until the directory passed exists.
Parameters:
Name Type Argument Description
path string The path you wish to make
options MkdirsOptions <optional>
Options for making the directories
Source:
nextra/mkdirs.js#L12
Returns:
Type
Promise.<void>

<static> ensureFile(file [, atomic])

Creates an empty file, making all folders required to satisfy the given file path.
Parameters:
Name Type Argument Default Description
file string Path of the file you want to create
atomic boolean <optional>
false Whether the operation should run atomically
Source:
nextra/createFile.js#L9
Returns:
Type
Promise.<void>

<static> ensureFileAtomic(file)

Creates an file copy, making all folders required to satisfy the given file path atomically.
Parameters:
Name Type Description
file string Path of the file you want to create
Source:
nextra/createFileAtomic.js#L3
Returns:
Type
Promise.<void>

<static> ensureFileCopy(source, destination [, options] [, atomic])

Creates an file copy, making all folders required to satisfy the given file path.
Parameters:
Name Type Argument Default Description
source string The path to the file you want to copy
destination string The path to the file destination
options WriteOptions | string <optional>
The write options or the encoding string.
atomic boolean <optional>
false Whether the operation should run atomically
Source:
nextra/createFileCopy.js#L8
Returns:
Type
Promise.<void>

<static> ensureFileCopyAtomic(source, destination [, options])

Creates a file copy atomically, making all folders required to satisfy the given file path.
Parameters:
Name Type Argument Description
source string The path to the file you want to copy
destination string The path to the file destination
options WriteOptions | string <optional>
The write options or the encoding string.
Source:
nextra/createFileCopyAtomic.js#L3
Returns:
Type
Promise.<void>

Creates a hard file link, making all folders required to satisfy the given file path.
Parameters:
Name Type Argument Default Description
source string The source path of the file
destination string The destination path of the file
atomic boolean <optional>
false Whether the operation should run atomically
Source:
nextra/createLink.js#L9
Returns:
Type
Promise.<void>

<static> ensureLinkAtomic(source, destination)

Creates a hard file link, making all folders required to satisfy the given file path atomically.
Parameters:
Name Type Description
source string The source path of the file
destination string The destination path of the file
Source:
nextra/createLinkAtomic.js#L3
Returns:
Type
Promise.<void>

Creates a soft file link, making all folders required to satisfy the given file path.
Parameters:
Name Type Argument Default Description
source string The source path of the file
destination string The destination path of the file
type SymLinkType <optional>
The type of symlink you are creating
atomic boolean <optional>
false Whether the operation should run atomically
Source:
nextra/createSymlink.js#L8
Returns:
Type
Promise.<void>

<static> ensureSymlinkAtomic(source, destination [, type])

Creates a soft file link, making all folders required to satisfy the given file path atomically.
Parameters:
Name Type Argument Description
source string The source path of the file
destination string The destination path of the file
type SymLinkType <optional>
The type of symlink you are creating
Source:
nextra/createSymlinkAtomic.js#L3
Returns:
Type
Promise.<void>

<static> linkAtomic(source, destination)

Creates a hard file link atomically.
Parameters:
Name Type Description
source string The source path of the file
destination string The destination path of the file
Source:
nextra/linkAtomic.js#L6
Returns:
Type
Promise.<void>

<static> mkdirp(path [, options])

Recursively makes directories, until the directory passed exists.
Parameters:
Name Type Argument Description
path string The path you wish to make
options MkdirsOptions <optional>
Options for making the directories
Source:
nextra/mkdirs.js#L20
Returns:
Type
Promise.<void>

<static> mkdirs(path [, options])

Recursively makes directories, until the directory passed exists.
Parameters:
Name Type Argument Description
path string The path you wish to make
options MkdirsOptions <optional>
Options for making the directories
Source:
nextra/mkdirs.js#L28
Returns:
Type
Promise.<void>

<static> move(source, destination [, options])

Parameters:
Name Type Argument Default Description
source string The source path of the file
destination string The destination path of the file
options MoveOptions <optional>
{} The options for the move
Source:
nextra/move.js#L17
Returns:
Type
Promise.<void>

<static> outputFile(file, data [, options] [, atomic])

Writes a file to disk, creating all directories needed to meet the filepath provided.
Parameters:
Name Type Argument Default Description
file string The path to the file you want to create
data string | Buffer | Uint8Array The data to write to file
options WriteOptions | string <optional>
The write options or the encoding string.
atomic boolean <optional>
false {description}
Source:
nextra/outputFile.js#L8
Returns:
Type
Promise.<void>

<static> outputFileAtomic(file, data [, options])

Writes a file to disk, creating all directories needed to meet the filepath provided atomically.
Parameters:
Name Type Argument Description
file string The path to the file you want to create
data string | Buffer | Uint8Array The data to write to file
options WriteOptions | string <optional>
The write options or the encoding string.
Source:
nextra/outputFileAtomic.js#L3
Returns:
Type
Promise.<void>

<static> outputJSON(file, data [, options] [, atomic])

Writes a json file to disk, creating all directories needed to meet the filepath provided.
Parameters:
Name Type Argument Default Description
file string The path to the file you want to create
data Object | Array The data to write to file
options WriteOptions | string <optional>
The write options or the encoding string.
atomic boolean <optional>
false {description}
Source:
nextra/outputJSON.js#L17
Returns:
Type
Promise.<void>

<static> outputJson(file, data [, options] [, atomic])

Writes a json file to disk, creating all directories needed to meet the filepath provided.
Parameters:
Name Type Argument Default Description
file string The path to the file you want to create
data Object | Array The data to write to file
options WriteOptions | string <optional>
The write options or the encoding string.
atomic boolean <optional>
false {description}
Source:
nextra/outputJSON.js#L7
Returns:
Type
Promise.<void>

<static> outputJSONAtomic(file, data [, options])

Writes a json file to disk, creating all directories needed to meet the filepath provided atomically.
Parameters:
Name Type Argument Description
file string The path to the file you want to create
data Object | Array The data to write to file
options WriteOptions | string <optional>
The write options or the encoding string.
Source:
nextra/outputJSONAtomic.js#L12
Returns:
Type
Promise.<void>

<static> outputJsonAtomic(file, data [, options])

Writes a json file to disk, creating all directories needed to meet the filepath provided atomically.
Parameters:
Name Type Argument Description
file string The path to the file you want to create
data Object | Array The data to write to file
options WriteOptions | string <optional>
The write options or the encoding string.
Source:
nextra/outputJSONAtomic.js#L3
Returns:
Type
Promise.<void>

<static> pathExists(path)

Checks if a path exists.
Parameters:
Name Type Description
path string The path to check
Source:
nextra/pathExists.js#L3
Returns:
Type
Promise.<boolean>

<static> readJson(file [, options])

Reads a file and parses it into a javascript object.
Parameters:
Name Type Argument Default Description
file string The file path to the json file
options ReadJSONOptions | string <optional>
{} The options for reading json or the encoding string
Source:
nextra/readJSON.js#L10
Returns:
Type
Promise.<Object>

<static> readJSON(file [, options])

Reads a file and parses it into a javascript object.
Parameters:
Name Type Argument Default Description
file string The file path to the json file
options ReadJSONOptions | string <optional>
{} The options for reading json or the encoding string
Source:
nextra/readJSON.js#L18
Returns:
Type
Promise.<Object>

<static> remove(path [, options])

Removes a single file or single directory with no children.
Parameters:
Name Type Argument Default Description
path string The path to remove
options RemoveOptions <optional>
{} {description}
Source:
nextra/remove.js#L12
Returns:
Type
Promise.<void>

<static> scan(root [, options])

Recursively scans a directory, returning a map of stats keyed on the full path to the item.
Parameters:
Name Type Argument Default Description
root string The path to scan
options ScanOptions <optional>
{} The options for the scan
Source:
nextra/scan.js#L11
Returns:
Type
Promise.<Map.<string, Stats>>

<static> symlinkAtomic(source, destination [, type])

Creates a soft file link atomically.
Parameters:
Name Type Argument Default Description
source string The source path of the file
destination string The destination path of the file
type SymLinkType <optional>
'file' The type of symlink you are creating
Source:
nextra/symlinkAtomic.js#L15
Returns:
{description}
Type
Promise.<void>

<static> writeFileAtomic(file, data [, options])

Parameters:
Name Type Argument Description
file string The path to the file you want to create
data string | Buffer | Uint8Array The data to write to file
options WriteOptions | string <optional>
The write options or the encoding string.
Source:
nextra/writeFileAtomic.js#L14
Returns:
Type
Promise.<void>

<static> writeJson(file, object [, options] [, atomic])

Writes a Javascript Object to file as JSON.
Parameters:
Name Type Argument Default Description
file string The path to the file you want to create
object Object The javascript object you would like to write to file
options JsonOptions <optional>
{} The options to pass JSON.stringify and writeFile
atomic boolean <optional>
false Whether the operation should run atomically
Source:
nextra/writeJSON.js#L15
Returns:
Type
Promise.<void>

<static> writeJSON(file, object [, options] [, atomic])

Writes a Javascript Object to file as JSON.
Parameters:
Name Type Argument Default Description
file string The path to the file you want to create
object Object The javascript object you would like to write to file
options JsonOptions <optional>
{} The options to pass JSON.stringify and writeFile
atomic boolean <optional>
false Whether the operation should run atomically
Source:
nextra/writeJSON.js#L25
Returns:
Type
Promise.<void>

<static> writeJsonAtomic(file, object [, options])

Writes a Javascript Object to file as JSON atomically.
Parameters:
Name Type Argument Default Description
file string The path to the file you want to create
object Object The javascript object you would like to write to file
options JsonOptions <optional>
{} The options to pass JSON.stringify and writeFile
Source:
nextra/writeJSONAtomic.js#L3
Returns:
Type
Promise.<void>

<static> writeJSONAtomic(file, object [, options])

Writes a Javascript Object to file as JSON atomically.
Parameters:
Name Type Argument Default Description
file string The path to the file you want to create
object Object The javascript object you would like to write to file
options JsonOptions <optional>
{} The options to pass JSON.stringify and writeFile
Source:
nextra/writeJSONAtomic.js#L12
Returns:
Type
Promise.<void>

Type Definitions


CopyOptions

Type:
  • Object
Properties:
Name Type Argument Default Description
filter function <optional>
A filter function to determine which files to copy.
overwrite boolean <optional>
true Whether to overwrite files or not.
preserveTimestamps boolean <optional>
true Whether or not to preserve timestamps on the files.
errorOnExist boolean <optional>
false Whether or not to error if the destination exists
Source:
nextra/copy.js#L9

JsonOptions

Type:
  • Object
Properties:
Name Type Argument Default Description
replacer function <optional>
A JSON.stringify replacer function
spaces number <optional>
null The number of spaces to format the json file with
encoding string <optional>
'utf8' The file encoding
mode number <optional>
0o666 The chmod
flag string <optional>
'w' The flag
Source:
nextra/writeJSON.js#L5

MkdirsOptions

Type:
  • Object
Properties:
Name Type Argument Default Description
mode number <optional>
0o777 & ~process.umask() The chmod for the directories being made
Source:
nextra/mkdirs.js#L6

MoveOptions

Type:
  • Object
Properties:
Name Type Argument Default Description
overwrite boolean <optional>
false Should the move overwrite an identical file at the destination path
Source:
nextra/move.js#L11

ReadJSONOptions

Type:
  • Object
Properties:
Name Type Argument Description
encoding string <optional>
The file encoding to use while reading
reviver function <optional>
The reviver function to pass to JSON.parse()
Source:
nextra/readJSON.js#L3

RemoveOptions

Type:
  • Object
Properties:
Name Type Argument Default Description
maxBusyTries number <optional>
3 The number of times fs-nextra should retry removing a busy file.
Source:
nextra/remove.js#L6

ScanOptions

Type:
  • Object
Properties:
Name Type Argument Description
filter function <optional>
A filter function receiving (stats, path) to determine if the returned map should include a given entry
depthLimit number <optional>
How many directories deep the scan should go (0 is just the children of the passed root directory, no subdirectory files)
Source:
nextra/scan.js#L4

SymLinkType

The type of symlink you are creating: * `dir` * `file` * `junction`
Type:
  • string
Source:
nextra/symlinkAtomic.js#L6

WriteOptions

Type:
  • Object
Properties:
Name Type Argument Default Description
encoding string <optional>
'utf8' The file encoding
mode number <optional>
0o666 The chmod
flag string <optional>
'w' The flag
Source:
nextra/writeFileAtomic.js#L6