1.0.1 • Published 4 years ago

arcanophile v1.0.1

Weekly downloads
5
License
ISC
Repository
-
Last release
4 years ago

arcanophile

Installation

npm i arcanophile
import { readFile } from "arcanophile";

Functions

folderExists(targetPath, createOnRun) ⇒ Boolean

Checks if path exists and is actually a directory, optionally creates the folder whenever investigated

Kind: global function
Returns: Boolean - Whether path existed at time of investigating

ParamTypeDefaultDescription
targetPathStringRelative or absolute file path
createOnRunBooleantrueIf TRUE, create empty folder if didn't previously exist

fileExists(targetPath, createOnRun) ⇒ Boolean

Returns Boolean if path exists and it's a valid folder, optionally creates the folder whenever investigated

Kind: global function
Returns: Boolean - Whether path exists

ParamTypeDescription
targetPathStringRelative or absolute file path
createOnRunBooleanIf TRUE, create empty folder if didn't previously exist

exists(targetPath) ⇒ Boolean

Type independent function to check existence of path

Kind: global function
Returns: Boolean - Whether path exists

ParamTypeDescription
targetPathStringRelative or absolute file path

makeFolder(targetPath) ⇒ Boolean

Shorter alias of a mkdir function to create a folder at specified path

Kind: global function
Returns: Boolean - Whether folder creation was successful

ParamTypeDescription
targetPathStringRelative or absolute file path

makeFile(targetPath, data, options) ⇒ Boolean

Shorter alias of a writeFileSync function to create a file at specified path

Kind: global function
Returns: Boolean - Whether folder creation was successful

ParamTypeDefaultDescription
targetPathStringRelative or absolute file path
dataString | Buffer | URLContents of file
optionsObjectKey/values for encoding, mode, and flag

isFolder(targetPath) ⇒ Boolean

Verify a given path string is actually a directory and not a type of file

Kind: global function
Returns: Boolean - Whether path exists

ParamTypeDescription
targetPathStringRelative or absolute file path

readFiles(folderPath, verbose) ⇒ Array

Thenable way to get all the file contents of a folder path

Kind: global function
Returns: Array - String data of each file contained within

ParamTypeDefaultDescription
folderPathStringRelative or absolute folder path
verboseBooleantrueIf false, only return file content, otherwise return detailed File object

readFile(folderPath, verbose) ⇒ Array

Thenable way to get a file's contents

Kind: global function
Returns: Array - String data of each file contained within

ParamTypeDescription
folderPathStringRelative or absolute folder path
verboseBooleanIf false, only return file content, otherwise return detailed File object

readDirs(folderPath, flatten) ⇒ Array

Returns the children filepaths of each folder Array entry

Kind: global function
Returns: Array - Any filepaths contained within a target folderpath entry

ParamTypeDescription
folderPathStringRelative or absolute folder path
flattenBooleanReturn as a single Array, otherwise return as Array of separate nested Arrays

readDir(folderPath) ⇒ Array

Returns the children filepaths of given folder path

Kind: global function
Returns: Array - Paths to each child file entry

ParamTypeDescription
folderPathStringRelative or absolute folder path
1.0.1

4 years ago

1.0.0

5 years ago