atutility v1.0.30
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 atutilityconst 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')11 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago