1.0.21 • Published 5 months ago

atutility v1.0.21

Weekly downloads
-
License
ISC
Repository
github
Last release
5 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.21

5 months ago

1.0.19

9 months ago

1.0.18

9 months ago

1.0.17

10 months ago

1.0.20

6 months ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago