@@ -18,7 +18,7 @@ const randomcharlengh = randomChar.length;
1818* @return {Promise<string[]> } return a promise of files path
1919* Will be use when encrypt dir feature will be created
2020*/
21- async function readDir ( directory : string ) : Promise < string [ ] > {
21+ export async function readDir ( directory : string ) : Promise < string [ ] > {
2222 let files = await readdir ( directory )
2323 return files . map ( file => `${ directory } /${ file } ` )
2424}
@@ -27,7 +27,7 @@ async function readDir(directory : string) : Promise<string[]> {
2727* @param {string } path take the path
2828* @return {Promise<string> } return promise of data
2929*/
30- async function readFile ( path : string ) : Promise < string > {
30+ export async function readFile ( path : string ) : Promise < string > {
3131 let files : Buffer = await readfile ( path )
3232 return files . toString ( )
3333}
@@ -36,7 +36,7 @@ async function readFile(path : string) : Promise<string> {
3636* @param {number } length take the number of element in your string
3737* @return {string } Return the random string
3838*/
39- function RandomString ( length : number ) : string {
39+ export function RandomString ( length : number ) : string {
4040 var result : string
4141 for ( var i = 0 ; i < length ; i ++ ) {
4242 result += randomChar . charAt ( Math . floor ( Math . random ( ) * randomcharlengh ) ) ;
@@ -50,7 +50,7 @@ function RandomString(length : number) : string {
5050* @param {string | undefined } key take the key if none specified one will be generated
5151* @return {string } Return the key
5252*/
53- async function CryptFile ( path : string , dest : string , key ? : string ) : Promise < string > {
53+ export async function CryptFile ( path : string , dest : string , key ? : string ) : Promise < string > {
5454 let enckey = key
5555 if ( ! enckey ) {
5656 enckey = RandomString ( 20 )
@@ -68,7 +68,7 @@ async function CryptFile(path : string, dest : string, key? : string) : Promise<
6868* @param {string } key take the secret key
6969* @return {string } Return the key
7070*/
71- async function DecryptFile ( path : string , dest : string , key : string ) : Promise < string > {
71+ export async function DecryptFile ( path : string , dest : string , key : string ) : Promise < string > {
7272 let enckey = key
7373 let crypt = new Cryptr ( enckey )
7474 const data = await readFile ( path )
0 commit comments