Constructor
new WriteNpmStat(packageName, outDiropt)
Initialize WriteNpmStat class
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
packageName |
string | name of the target npm package | |
outDir |
string | null |
<optional> |
path of the directory where the gathered data will be saved into csv files |
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
outDir |
string | null |
<optional> |
path of the directory where the gathered data will be saved into csv files | |
datePeriod |
StatPeriod |
<optional> |
year | grouping of the statistics |
writePackageName |
boolean |
<optional> |
false | flag used to write the name of the package into a csv column |
mergeStoredData |
boolean |
<optional> |
true | flag used to merge actual npm statistics with previously stored |
- Source:
Methods
getLastWeekNpmStat() → {Promise}
Returns last week npm statistics for a package
- Source:
Returns:
Promise object represents the last week npm statistics for a package
- Type
- Promise
getNpmStat(startDateopt, endDateopt) → {Promise}
Returns npm statistics for a package
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
startDate |
string | null |
<optional> |
start date of the statistics
should be in one of the following formats:
- "%Y", for example "2022", which means to be collected from "2022-01-01" - "%Y-%m", for example "2022-01", which means to be collected from "2022-01-01" - "%Y-%m-%d", for example "2022-01-01", which means to be collected from "2022-01-01" - undefined, which means to be collected from the last half year |
endDate |
string | null |
<optional> |
end date of the statistics
should be in one of the following formats:
- "%Y", for example "2022", which means to be collected until "2022-12-31" - "%Y-%m", for example "2022-12", which means to be collected until "2022-12-31" - "%Y-%m-%d", for example "2022-12-31", which means to be collected until "2022-12-31" - undefined, which means to be collected until the actual day |
- Source:
Returns:
Promise object represents the npm statistics for a package
- Type
- Promise
writeLastWeekNpmStat(postfixopt) → {Promise}
Writes last week npm statistics for a package
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
postfix |
string | null |
<optional> |
lastweek_npmstat | postfix of the csv file |
- Source:
Returns:
Promise object represents the last week npm statistics for a package
- Type
- Promise
writeNpmStat(startDateopt, endDateopt, postfixopt) → {Promise}
Writes npm statistics for a package
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
startDate |
string | null |
<optional> |
start date of the statistics
should be in one of the following formats:
- "%Y", for example "2022", which means to be collected from "2022-01-01" - "%Y-%m", for example "2022-01", which means to be collected from "2022-01-01" - "%Y-%m-%d", for example "2022-01-01", which means to be collected from "2022-01-01" - undefined, which means to be collected from the last half year |
|
endDate |
string | null |
<optional> |
end date of the statistics
should be in one of the following formats:
- "%Y", for example "2022", which means to be collected until "2022-12-31" - "%Y-%m", for example "2022-12", which means to be collected until "2022-12-31" - "%Y-%m-%d", for example "2022-12-31", which means to be collected until "2022-12-31" - undefined, which means to be collected until the actual day |
|
postfix |
string | null |
<optional> |
npmstat | postfix of the csv file |
- Source:
Returns:
Promise object represents the npm statistics for a package
- Type
- Promise