1.0.0 • Published 3 years ago

abrupt-file v1.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

abrupt-rand is a derivative of the entire packge abrupt https://www.npmjs.com/package/abrupt

File

// File Library: seperating (file/directory)'s are handle in the function 
const file = require("abrupt/file")

// Create

file.create("Hello.txt", "Hello World!") // creates a text file containing "Hello World!"
file.create(["Hi.txt", "Welcome.txt"], ["Hello", "World!"]) // creates two text files with content corresponding to each array

file.create("Hello") // create a folder called hello
file.create(["Hello", "World"]) // creates two folders
// file.create(["Hello", "World"]) == file.create("Hello", "World") == file.create("Hello", ["World"])

// will create folders if they are missing  
file.create("this/is/three/folders.txt", "without this argument it would be a folder") 


// Exists

file.exists("this") // folder
file.exists("Hello.txt") // file
file.exists("not") // false
file.exists(["this", "Hello.txt", "not"]) // ["folder", "file", false]
// file.exists(["this", "Hello.txt", "not"]) == file.exists("this", "Hello.txt", "not")

// Read
// file.read(String Name, String Encoding)
file.read("Hello.txt") // Default Encoding: UTF8
file.read("this") // read's (file/directory) by (string/array)

// Remove

file.remove("this") // true
file.remove(["Hello.txt", "not"]) // [true, false] 
// file.remove(["Hello.txt", "not"]) == file.remove("Hello.txt", "not")