Class: WriteJsdelivrStat

WriteJsdelivrStat(packageName, outDiropt)

Class to collect, filter and save jsdelivr statistics to csv files

Constructor

new WriteJsdelivrStat(packageName, outDiropt)

Initialize WriteJsdelivrStat 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 jsdelivr statistics with previously stored
Source:

Methods

getJsdelivrStat(startDateopt, endDateopt) → {Promise}

Returns jsdelivr 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 jsdelivr statistics for a package
Type
Promise

writeJsdelivrStat(startDateopt, endDateopt, postfixopt) → {Promise}

Writes jsdelivr 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>
jsdelivrstat postfix of the csv file
Source:
Returns:
Promise object represents the jsdelivr statistics for a package
Type
Promise