1.0.30 • Published 7 months ago

atutility v1.0.30

Weekly downloads
-
License
ISC
Repository
github
Last release
7 months ago

A simple node js and javascript utility for a few useful functionalities including a logger that can log any string to a file with a timestamp.

npm install atutility
const ATUtility = require('atutility')
ATUtility.log("I'll create a log folder for you and log this string with a timestamp")

The log function by default also console logs every input, you can disable or enable this feature any time using the following functions

ATUtility.enableConsoleLog()
ATUtility.disableConsoleLog()
ATUtility.capitalizeFirstLetter('apple')

Check to see if a JSON string is valid and parsable.

ATUtility.isStringifiedJSONValid(str)

Convert an array of objects to an array of keyless result set that keep their order.

ATUtility.getKeylessResultSet(arrayOfObject)
ATUtility.getWorkingDirectoryPath("/A/Relative/Path/To/Working/Directory")

Create a directory asynchronously if it doesn't exists, the result is a promise.

ATUtility.createDirectory('New Folder')
.then(() => {
    console.log('success')
})
.catch((error) => {
    console.log(error)
})

Create a directory synchronously if it doesn't exists.

ATUtility.createDirectorySync('New Folder')

Get a list of all the files inside a folder.

const fileList = ATUtility.getFileListSync('My folder path')

Read a single file asynchronously and return the result as a promise.

ATUtility.readFile('myTextFile.txt')
.then((data) => {
    console.log(data)
})
.catch(() => {
    console.log(error)
})

Read a single file synchronously and return the result.

const data = ATUtility.readFileSync('myTextFile.txt')
1.0.30

7 months ago

1.0.29

10 months ago

1.0.28

11 months ago

1.0.22

11 months ago

1.0.26

11 months ago

1.0.25

11 months ago

1.0.24

11 months ago

1.0.23

11 months ago

1.0.27

11 months ago

1.0.21

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.20

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago