npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@jwd-gg/met

v1.1.0

Published

![npm](https://img.shields.io/npm/v/@jwd-gg/met?color=blue) ![bun](https://img.shields.io/badge/runtime-Bun-pink) ![license](https://img.shields.io/badge/license-MIT-green)

Downloads

8

Readme

npm bun license

A lightweight TypeScript client for the Metropolitan Museum of Art Collection API.


Installation

Install with Bun:

bun add @jwd-gg/met

Or with npm/yarn:

npm install @jwd-gg/met --save
# or
yarn add @jwd-gg/met

Usage

import { fetcher } from '@jwd-gg/met';

async function main() {
  try {
    const { total, objectIDs } = await fetcher.getObjects();
    console.log(`Found ${total} objects. First IDs:`, objectIDs.slice(0, 5));

    const firstId = objectIDs[0];
    const details = await fetcher.getObject(firstId);
    console.log(`Title of object ${firstId}:`, details.title);
  } catch (err) {
    console.error(err);
  }
}

main();
// Found 495651 objects. First IDs: [ 1, 2, 3, 4, 5 ]
// Title of object 1: One-dollar Liberty Head Coin

API Reference

fetcher.getObjects()

Fetches the total number of objects and a list of all object IDs currently in the collection that are available via the API.

Signature:

fetcher.getObjects(): Promise<ObjectsResponse>

Returns: Promise<ObjectsResponse>

export interface ObjectsResponse {
  /** The total number of object IDs */
  total: number;
  /** An array of object IDs */
  objectIDs: number[];
}

fetcher.getObject(id)

Retrieves detailed information for a single object identified by its objectID.

Signature:

fetcher.getObject(id: number): Promise<ObjectDetails>

Parameters:

  • id (number): The unique identifier for the object.

Returns: Promise<ObjectDetails>

// Note: Some fields are optional and may not be present for all objects.

interface Constituent {
  constituentID: number;
  role: string;
  name: string;
  constituentULAN_URL?: string;
  constituentWikidata_URL?: string;
  gender?: string;
}

interface ElementMeasurements {
  Height?: number;
  Width?: number;
  Depth?: number;
  Length?: number;
  [key: string]: number | undefined;
}

interface Measurement {
  elementName: string;
  elementDescription: string | null;
  elementMeasurements: ElementMeasurements;
}

interface ParsedDimension {
  element: string;
  dimensionType: string;
  dimension: number;
}

interface Tag {
  term: string;
  AAT_URL: string;
  Wikidata_URL?: string;
}

export interface ObjectDetails {
  /** A unique identifier for the object */
  objectID: number;
  /** Indicates if the object is a highlight */
  isHighlight: boolean;
  /** The object's accession number */
  accessionNumber: string;
  /** The year the object was accessioned */
  accessionYear: string;
  /** Indicates if the object is in the public domain */
  isPublicDomain: boolean;
  /** URL to the primary image */
  primaryImage: string;
  /** URL to a smaller version of the primary image */
  primaryImageSmall: string;
  /** URLs to additional images, if available */
  additionalImages: string[];
  /** Information about the artists or makers */
  constituents: Constituent[] | null;
  /** The department associated with the object */
  department: string;
  /** The type of object */
  objectName: string;
  /** The title of the object */
  title: string;
  /** Information about the culture or people associated with the object */
  culture: string;
  /** The historical period */
  period: string;
  /** The dynasty, if applicable */
  dynasty: string;
  /** The reign, if applicable */
  reign: string;
  /** Portfolio information, if applicable */
  portfolio: string;
  /** Role of the primary artist */
  artistRole: string;
  /** Prefix for the artist's name */
  artistPrefix: string;
  /** Display name for the artist */
  artistDisplayName: string;
  /** Biographical information for the artist */
  artistDisplayBio: string;
  /** Suffix for the artist's name */
  artistSuffix: string;
  /** Sorted version of the artist's name */
  artistAlphaSort: string;
  /** Nationality of the artist */
  artistNationality: string;
  /** Start year of the artist's life */
  artistBeginDate: string;
  /** End year of the artist's life */
  artistEndDate: string;
  /** Gender of the artist */
  artistGender?: string;
  /** Wikidata URL for the artist */
  artistWikidata_URL?: string;
  /** ULAN URL for the artist */
  artistULAN_URL?: string;
  /** Date of the object's creation or origin */
  objectDate: string;
  /** Start year for the object's date */
  objectBeginDate: number;
  /** End year for the object's date */
  objectEndDate: number;
  /** Materials used to create the object */
  medium: string;
  /** Text description of the object's dimensions */
  dimensions: string;
  /** Parsed dimensions, if available */
  dimensionsParsed: ParsedDimension[] | null;
  /** Detailed measurements, if available */
  measurements: Measurement[] | null;
  /** Credit line for the object */
  creditLine: string;
  /** Type of geographical location associated with the object */
  geographyType: string;
  /** City associated with the object */
  city: string;
  /** State associated with the object */
  state: string;
  /** County associated with the object */
  county: string;
  /** Country associated with the object */
  country: string;
  /** Region associated with the object */
  region: string;
  /** Subregion associated with the object */
  subregion: string;
  /** Locale associated with the object */
  locale: string;
  /** Locus associated with the object */
  locus: string;
  /** Excavation site, if applicable */
  excavation: string;
  /** River associated with the object */
  river: string;
  /** General classification of the object */
  classification: string;
  /** Rights and reproduction information */
  rightsAndReproduction: string;
  /** Link to an external resource, often the object page on metmuseum.org */
  linkResource: string;
  /** Date the metadata was last updated */
  metadataDate: string;
  /** Repository where the object is held (usually "The Metropolitan Museum of Art") */
  repository: string;
  /** URL to the object's page on metmuseum.org */
  objectURL: string;
  /** Associated tags or keywords */
  tags: Tag[] | null;
  /** Wikidata URL for the object */
  objectWikidata_URL?: string;
  /** Indicates if the object is considered a timeline work */
  isTimelineWork: boolean;
  /** Gallery number where the object might be displayed */
  GalleryNumber: string;
}

fetcher.getDepartments()

Retrieves the list of museum departments, including their names and IDs.

Signature:

fetcher.getDepartments(): Promise<DepartmentList>

Returns: Promise<DepartmentList>

export interface Department {
  /** A unique identifier for the department */
  departmentId: number;
  /** The display name of the department */
  displayName: string;
}

/** An array of Department objects */
export type DepartmentList = Department[];

fetcher.search(query, options?)

Performs a search across the collection based on a keyword or query string. Returns the total number of matching objects and their IDs.

Signature:

fetcher.search(q: string, options?: SearchOptions): Promise<SearchResponse>

Parameters:

  • q (string): The search query string (required).
  • options (SearchOptions, optional): An object containing filter parameters.

Returns: Promise<SearchResponse>

export interface SearchOptions {
  /** Set to true to search only for highlighted objects. */
  isHighlight?: boolean;
  /** Set to true to search only against the title field. */
  title?: boolean;
  /** Set to true to search only against the subject keyword tags field. */
  tags?: boolean;
  /** Restricts search to a specific department by ID. */
  departmentId?: number;
  /** Set to true to search only for objects currently on view. */
  isOnView?: boolean;
  /** Set to true to search only against the artist name or culture field. */
  artistOrCulture?: boolean;
  /** Filter by medium. Accepts a single string or an array of strings (e.g., "Paintings", ["Ceramics", "Furniture"]). */
  medium?: string | string[];
  /** Set to true to search only for objects with images. */
  hasImages?: boolean;
  /** Filter by geographic location. Accepts a single string or an array of strings (e.g., "Europe", ["France", "Paris"]). */
  geoLocation?: string | string[];
  /** Start year for date range filter (inclusive). Requires dateEnd. */
  dateBegin?: number;
  /** End year for date range filter (inclusive). Requires dateBegin. */
  dateEnd?: number;
}
export interface SearchResponse {
  /** The total number of objects matching the search query */
  total: number;
  /** An array of object IDs matching the search query. Can be null if no results are found. */
  objectIDs: number[] | null; // API documentation notes it can be null
}

Development

  1. Clone the repository:
    git clone https://github.com/jwd-gg/met.git
    cd met
  2. Install dependencies:
    bun install
  3. Build:
    bun run build

Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue.

License

This project is licensed under the MIT License. See the LICENSE file for details, or refer to https://choosealicense.com/licenses/mit/.