Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DistInfo ¶
type DistInfo struct {
Tarball string `json:"tarball"`
Shasum string `json:"shasum"`
Integrity string `json:"integrity"`
UnpackedSize int `json:"unpackedSize"` // The registry gives a numeric "unpackedSize"
}
DistInfo holds distribution-related fields for a specific version.
type DownloadsResponse ¶
type DownloadsResponse struct {
Downloads int `json:"downloads"`
Start string `json:"start"`
End string `json:"end"`
Package string `json:"package"`
}
DownloadsResponse is the response from the downloads API at https://api.npmjs.org/downloads/point/last-week/<packageName>.
type NpmPackageInfo ¶
type NpmPackageInfo struct {
Name string
Version string
License string
UnpackedSizeKB string // We’ll convert from int bytes to a human-readable "KB"
WeeklyDownloads string
Created string
Modified string
LastPublished string
}
NpmPackageInfo is what we'll return with all fields we care about.
func FetchNpmPackageInfo ¶
func FetchNpmPackageInfo(packageName string) (*NpmPackageInfo, error)
FetchNpmPackageInfo fetches metadata from the registry and weekly downloads from the npmjs.org API
type NpmTime ¶
NpmTime holds creation and modification times for the entire package. We'll also parse the "last published" date from a specific version.
type RegistryResponse ¶
type RegistryResponse struct {
Name string `json:"name"`
Time map[string]string `json:"time"` // Each version has a date, plus "created", "modified"
Versions map[string]VersionInfo `json:"versions"` // Keyed by version string
DistTags map[string]string `json:"dist-tags"`
}
RegistryResponse is the overall response from https://registry.npmjs.org/<packageName>.
Click to show internal directories.
Click to hide internal directories.