Optional
config: NpmRegistryClientConfigGet the download count for the given packages between the given dates.
The options for getting the download count.
The download count for the given packages between the given dates.
client.getBetweenDates({
packages: [
'@aws-lambda-powertools/logger',
],
startDate: '2020-01-01',
endDate: '2020-01-15',
});
The response will be an array of objects, one for each package, with the following shape:
{
package: '@aws-lambda-powertools/logger',
downloads: 1234,
start: '2020-01-01',
end: '2020-01-15',
}
Get the daily downlods for the given packages during the last 30 available days.
The options for getting the daily download count.
The daily download count for the given packages during the last 30 available days.
client.getDailyDownloadsForLastMonth({
packages: [
'@aws-lambda-powertools/logger',
],
});
The response will be an array of objects, one for each package, with the following shape:
{
start: '2020-01-01',
end: '2020-01-31',
package: '@aws-lambda-powertools/logger',
downloads: [
{
downloads: 1234,
day: '2020-01-01',
},
// ... other days
{
downloads: 1234,
day: '2020-01-08',
},
]
}
Get the daily downlods for the given packages during the last 7 available days.
The options for getting the daily download count.
The daily download count for the given packages during the last 7 available days.
client.getDailyDownloadsForLastWeek({
packages: [
'@aws-lambda-powertools/logger',
],
});
The response will be an array of objects, one for each package, with the following shape:
{
start: '2020-01-01',
end: '2020-01-08',
package: '@aws-lambda-powertools/logger',
downloads: [
{
downloads: 1234,
day: '2020-01-01',
},
// ... other days
{
downloads: 1234,
day: '2020-01-08',
},
]
}
Get the daily downlods for the given packages on a given month.
You can use a month number (i.e. 01-12), an ISO week (i.e. 2023-01
).
The options for getting the daily download count.
The daily download count for the given packages on the given month.
// month 1 of the current year
client.getDailyDownloadsForWeek({
packages: [
'@aws-lambda-powertools/logger',
],
week: '01',
});
// month 1 of 2020
client.getDailyDownloadsForWeek({
packages: [
'@aws-lambda-powertools/logger',
],
week: '2020-01',
});
In all cases, the response will be an array of objects, one for each package, with the following shape:
{
start: '2020-01-01',
end: '2020-01-31',
package: '@aws-lambda-powertools/logger',
downloads: [
{
downloads: 1234,
day: '2020-01-01',
},
// ... other days
{
downloads: 1234,
day: '2020-01-31',
},
]
}
Get the daily downlods for the given packages on a given week.
You can use a week number (i.e. W01-W52), an ISO week (i.e. 2023W01
)
or a date (i.e. 2020-01-01). In the latter case, the week will be
calculated based on the date.
By default, the week will start on Monday and end on Sunday, but you
can change this by passing the startOfWeek
option.
The options for getting the daily download count.
The daily download count for the given packages on the given week.
// week 1 of the current year
client.getDailyDownloadsForWeek({
packages: [
'@aws-lambda-powertools/logger',
],
week: 'W01',
});
// week 1 of 2020
client.getDailyDownloadsForWeek({
packages: [
'@aws-lambda-powertools/logger',
],
week: '2020W01',
});
// week that includes 2020-01-01
client.getDailyDownloadsForWeek({
packages: [
'@aws-lambda-powertools/logger',
],
week: '2020-01-01',
});
// week that includes 2020-01-01, starting on Sunday
client.getDailyDownloadsForWeek({
packages: [
'@aws-lambda-powertools/logger',
],
week: '2020-01-01',
startOfWeek: 'sunday',
});
In all cases, the response will be an array of objects, one for each package, with the following shape:
{
start: '2020-01-01',
end: '2020-01-08',
package: '@aws-lambda-powertools/logger',
downloads: [
{
downloads: 1234,
day: '2020-01-01',
},
// ... other days
{
downloads: 1234,
day: '2020-01-08',
},
]
}
Get the download count for the given packages on a given date.
The options for getting the download count.
The download count for the given packages on the given date.
client.getDay({
packages: [
'@aws-lambda-powertools/logger',
],
date: '2020-01-01',
});
The response will be an array of objects, one for each package, with the following shape:
{
downloads: 1234,
start: '2020-01-01',
end: '2020-01-01',
package: '@aws-lambda-powertools/logger',
}
Get the download count for the last available day.
In practice, this will usually be "yesterday" (in GMT) but if stats for that day are not available, it will be the day before.
The options for getting the download count.
The download count for the given packages on the last available day.
client.getLastDay({
packages: [
'@aws-lambda-powertools/logger',
],
});
The response will be an array of objects, one for each package, with the following shape:
{
start: '2020-01-01',
end: '2020-01-01',
package: '@aws-lambda-powertools/logger',
downloads: 1234
}
Get the download count for the last 30 available days.
Depending on the time of day, this may include the current day or start on the day before (in GMT).
The options for getting the download count.
The download count for the given packages on the last 30 available days.
client.getLastMonth({
packages: [
'@aws-lambda-powertools/logger',
],
});
The response will be an array of objects, one for each package, with the following shape:
{
start: '2020-01-01',
end: '2020-01-01',
package: '@aws-lambda-powertools/logger',
downloads: 1234
}
Get the download count for the last 7 available days.
Depending on the time of day, this may start on the current day or the day before (in GMT).
The options for getting the download count.
The download count for the given packages on the last 7 available days.
client.getLastWeek({
packages: [
'@aws-lambda-powertools/logger',
],
});
The response will be an array of objects, one for each package, with the following shape:
{
start: '2020-01-01',
end: '2020-01-01',
package: '@aws-lambda-powertools/logger',
downloads: 1234
}
Get the download count for the given packages on the given month.
You can use a month number (i.e. 01-12), an ISO week (i.e. 2023-01
).
The options for getting the download count.
The download count for the given packages on the given month.
// month 1 of the current year
client.getMonth({
packages: [
'@aws-lambda-powertools/logger',
],
month: '01',
});
// month 1 of 2020
client.getMonth({
packages: [
'@aws-lambda-powertools/logger',
],
month: '2020-01',
});
In all cases, the response will be an array of objects, one for each package, with the following shape:
{
downloads: 1234;
start: '2020-01-01';
end: '2020-01-31';
package: '@aws-lambda-powertools/logger';
}
Get the download count for the given packages on a given week.
You can use a week number (i.e. W01-W52), an ISO week (i.e. 2023W01
)
or a date (i.e. 2020-01-01). In the latter case, the week will be
calculated based on the date.
By default, the week will start on Monday and end on Sunday, but you
can change this by passing the startOfWeek
option.
The options for getting the download count.
The download count for the given packages on the given week.
// week 1 of the current year
client.getWeek({
packages: [
'@aws-lambda-powertools/logger',
],
week: 'W1',
});
// week 1 of 2020
client.getWeek({
packages: [
'@aws-lambda-powertools/logger',
],
week: '2020W1',
});
// week that includes 2020-01-01
client.getWeek({
packages: [
'@aws-lambda-powertools/logger',
],
week: '2020-01-01',
});
// week that includes 2020-01-01, starting on Sunday
client.getWeek({
packages: [
'@aws-lambda-powertools/logger',
],
week: '2020-01-01',
startOfWeek: 'sunday',
});
In all cases, the response will be an array of objects, one for each package, with the following shape:
{
downloads: 1234,
start: '2020-01-01',
end: '2020-01-07',
package: '@aws-lambda-powertools/logger',
}
Generated using TypeDoc
A client for the npm package download API.
The client allows to retrieve the download count for a given day, week, month, or a relative period of time (e.g. last 7 days).
Example
Example
You can also use the client to get the daily download count for a given package in a period of time.
See
API Documentation