
Product
Rust Support Now in Beta
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
An npm package that enables fetching and analyzing GitHub user data, including repositories, contributions, and metadata. The package also provides utility functions for filtering and analyzing the fetched data.
You can see it live on here
npm:
npm install hubspy
yarn:
yarn add hubspy
pnpm:
pnpm add hubspy
import fetchGithubUserMetadata from 'hubspy';
const username = 'torvalds';
(async () => {
const userData = await fetchGithubUserMetadata(username);
console.log(userData);
})();
import GetRepositoriesData from 'hubspy';
const username = 'torvalds';
(async () => {
const repositories = await GetRepositoriesData(username);
console.log(repositories);
})();
import GetYearWiseContributions from 'hubspy';
const username = 'torvalds';
(async () => {
const contributions = await GetYearWiseContributions(username);
console.log(contributions);
})();
import checkValidUsernName from 'hubspy';
const username = 'torvalds';
(async () => {
const isValid = await checkValidUsernName(username);
console.log(isValid ? 'Valid username' : 'Invalid username');
})();
import { filterRepository } from 'hubspy';
const repositories = [/* Array of RepositoryData */];
const year = 2023; // Optional
const mostStarredRepo = filterRepository(repositories, year);
console.log(mostStarredRepo);
import { getMostStarredRepository } from 'hubspy';
const repositories = [/* Array of RepositoryData */];
const year = 2023; // Optional
const mostStarredRepos = getMostStarredRepository(repositories, year);
console.log(mostStarredRepos);
import { getTopLanguages } from 'hubspy';
const repositories = [/* Array of RepositoryData */];
const year = 2023; // Optional
const topLanguages = getTopLanguages(repositories, year);
console.log(topLanguages);
The package uses the following TypeScript types for better developer experience:
interface UserMetaData {
login: string;
id: number;
public_repos: number;
// other GitHub API fields...
}
interface RepositoryData {
name: string;
description: string;
starred: number;
last_updated_at: number;
top_language: string;
link_href: string;
}
interface YearContribution {
year: number;
contributions: number;
}
interface TopLanguageList {
language: string;
percentage: string;
}
All async functions throw an error if the request fails. Make sure to wrap calls in a try-catch
block to handle errors gracefully.
Feel free to fork the repository and submit pull requests. Ensure that your code follows the existing coding style and is thoroughly tested.
Setting | Value |
---|---|
Runtime | Nodejs>=(18.12.1) |
Entrypoint | src/index.ts |
Build Commands | npm run start |
This package uses scraping techniques for certain features, which may be subject to changes in GitHub's UI or terms of service. Use responsibly.
FAQs
A package to extract github metadata and total contributions for a github user.
The npm package hubspy receives a total of 4 weekly downloads. As such, hubspy popularity was classified as not popular.
We found that hubspy demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket's Rust support is moving to Beta: all users can scan Cargo projects and generate SBOMs, including Cargo.toml-only crates, with Rust-aware supply chain checks.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.