project-uptime
v0.0.5
Published
An simple NPM package that lets you know How long your Project is Online
Downloads
5
Readme
project-uptime
An simple NPM package that lets you know How long your Project is Online
Installation
npm i project-uptime
project-uptime
is working at Node v4+
Documentation
A lot of endpoints are works Normal.
Main Function [Very Required] |Method|Description|Parameters|Returns| |-------|--------|--------|--------| |startRecord|Start/Resume Recording Your Project Uptime|-|-| |pauseRecord|Pause the Records. This doesn't Reset your Records.|-|-| |resetRecord|Reset all your Records to 0|-|-|
Records (Start after records
)
|Method|Description|Parameters|Returns|
|-------|--------|--------|--------|
|second|Gets your Second Records, Feel free for Customize your own design for Logging & Showing Records of Your Uptime ;)|-|Returning your Second Records|
|minute|Gets your Minute Records, Feel free for Customize your own design for Logging & Showing Records of Your Uptime ;)|-|Returning your Minute Records|
|hour|Gets your Hour Records, Feel free for Customize your own design for Logging & Showing Records of Your Uptime ;)|-|Returning your Hour Records|
|day|Gets your Day Records, Feel free for Customize your own design for Logging & Showing Records of Your Uptime ;)|-|Returning your Day Records|
|week|Gets your Week Records, Feel free for Customize your own design for Logging & Showing Records of Your Uptime ;)|-|Returning your Week Records.|
|month|Gets your Month Records, Feel free for Customize your own design for Logging & Showing Records of Your Uptime ;)|-|Returning your Month Records.|
|year|Gets your Year Records, Feel free for Customize your own design for Logging & Showing Record of your Uptime |-|Returning your Year Records.|
|all|Gets All Of Your Uptime Records. |-|Returning all of Your Records.|
|short|Telling your Uptime by returning Short Information.|-|Returns an Short Uptime Records|
NoFilter (Starts after NoFunction
)
NoFilter is an Function where The User can gets The Uptime Records without any Cutted Result. example, When Passed 1 Minute, The Output of NoFilter Second is 60
Which means 60 Second
.
Method|Description|Parameters|Returns|
|-------|--------|--------|--------|
|second|Gets your Second Records, Feel free for Customize your own design for Logging & Showing Records of Your Uptime. But that's Not CUTTED-OFF after 1 Minute Passed. So it keeps counting to 61, 62, and Above.|-|Returning your Second Records without Filter.|
|minute|Gets your Minute Records, Feel free for Customize your own design for Logging & Showing Records of Your Uptime. But that's not Filtered, So when 1 Hour passed, The Minute NoFiltered Output is 60
Which means 60 Minute, And keeps continue to 61, 62 and Above|-|Returning your Minute Records without Filter.|
|hour|Gets your Hour Records, Feel free for Customize your own design for Logging & Showing Records of Your Uptime, But that's NoFilter|-|Returning your Hour Records without Filter|
|day|Gets your Day Records, Feel free for Customize your own design for Logging & Showing Records of Your Uptime, But that's not Filtered.|-|Returning your Day Records without Filter|
|week|Gets your Week Records, Feel free for Customize your own design for Logging & Showing Records of Your Uptime, But not Filtered ;)|-|Returning your Week Records without Filter.|
|month|Gets your Month Records, Feel free for Customize your own design for Logging & Showing Records of Your Uptime, But not Foltered;)|-|Returning your Month Records without Filter.|
By the way, NoFilter Is not have Years NoFilter Record because YEAR records is already No Filtered, And that's Impossible if Project can Uptime at 23-98 Year.
Setup
- Let's begin the setup, But first, Let's Create an Variable
const projectuptime = require("project-uptime");
And last, Let's Start Record your Uptime
projectuptime.startRecord()
Let's see your Uptime, But we suggest you for Use short
projectuptime.records.short();
Output when your Project is Running at 30 Second
30 Second
Output when your Project is Running at 5 Minute
50 Minute
And keeps Recording 24/7.
Example & Output
-Example 1
- Showing All Records Information
const projectuptime = require("project-uptime");
// Lets Make it keeps Showing the Records
setInterval(function() {
console.clear()
//Clear the Console so it doesn't Spamming :D
// Remove `console.clear()` If your Node version is v4
console.log(projectuptime.records.all())
}, 1000);
//Let's start Recording
projectuptime.startRecord()
Output When runs 9 Hour:
0 Year : 0 Month : 0 Week : 0 Day : 9 Hour : 48 Minute : 32 Second
- Example 2
- Customing your own Design
const projectuptime = require("project-uptime");
//Let's Make Variable
var record = projectuptime.records;
var second = record.second();
var minute = record.minute();
var hour = record.hour();
var day = record.day();
var week = record.week();
var month = record.month();
var year = record.year();
//Make Blank Variable
var uptime;
// Lets Make it keeps Showing the Records
setInterval(function() {
// Change the uptime variable to Defined
// Keep that mind if uptime Variable must Changed Every time so the Output is Correct.
uptime = `${year} Year : ${month} Month : ${day} Day`
// You can Customize your Self Design
console.clear()
//Clear the Console so it doesn't Spamming :D
// Remove `console.clear()` If your Node version is v4
console.log(uptime)
// Return your Own design
}, 1000);
projectuptime.startRecord();
Output when Project Running at 5 Month
0 Year : 5 Month : 23 Day
Community
Any question or Doubt can Join our Discord Server.