Fileger
The most convinient way to work with Files in NodeJS
Notices
If you catch any errors feel free to write a mail paul.hanneforth.o@gmail.com
or create an issue on GitHub.
Installation
Install Fileger
via NPM
npm install fileger
Examples
File
This example creates the file configuration.json
, writes some things in it and then read it's contents and fileSize and then prints it to the console.
Then it encrypts the file, copies the encrypted file, then decrypts it and then deletes it.
// import the `File` class from `fileger`const File = const run = async { const file = "./configuration.json"; // object that will be written to the file const configuration = version: 23 inProduction: true await file; // creates the file await file; // writes the configuration object to the file const content = await file; // reads the file const fileSize = await file; // gets the size of the file in megabytes console await file; // encrypts the file with the password 'Password' const copiedFile = await file // copies the encrypted file await copiedFile; // decrypts the copied File await copiedFile; // deletes the copied File } ;
Directory
This example creates the directory ExampleFolder
, list all it's contents, encrypts all it's contents, copies the encrypted contents, then decrypts the copied directory and then zips it to the directory zippedFolder.zip
.
// import the `Directory` class from `Fileger`const Directory = const run = async { const dir = "./ExampleFolder"; await dir; // creates the directory const content = await dir; // lists all files and directories of the directory content; // prints out all the file and directory paths await dir // encrypts all the files and directories with the password `example-password` const copiedDir = await dir; // copies the directory await copiedDir // decrypts all the files and directories of the copied directory copiedDir // zips the copiedFolder } ;
Usage
CLI
Fileger
also can be used as a CLI.
To install it run:
npm install -g fileger
To see all commands run:
fl help