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

bing-wallpaper-api

v1.0.35

Published

获取必应每日壁纸的 npm 包,支持日期、时区、分辨率和市场参数。

Readme

Bing Wallpaper API

获取必应每日壁纸的轻量 npm 包,支持按日期、时区、分辨率和市场获取图片信息,提供 TypeScript 类型定义,同时兼容 ESM 和 CommonJS。

npm version npm downloads GitHub license

演示项目: https://github.com/wu529778790/bing-wallpaper
演示地址: https://bing.shenzjd.com/

特性

  • 获取必应每日壁纸
  • 支持按日期获取最近 7 天壁纸
  • 支持多种分辨率
  • 支持多个 Bing 市场
  • 支持显式指定 IANA 时区
  • 内置内存缓存
  • 提供完整 TypeScript 类型
  • 同时支持 ESM 和 CommonJS

安装

npm install bing-wallpaper-api

快速开始

ESM

import { getBingWallpaper } from "bing-wallpaper-api";

const wallpaper = await getBingWallpaper({
  timezone: "Asia/Shanghai",
  resolution: "UHD",
});

console.log(wallpaper.title);
console.log(wallpaper.url);

CommonJS

const { getBingWallpaper } = require("bing-wallpaper-api");

(async () => {
  const wallpaper = await getBingWallpaper();
  console.log(wallpaper.url);
})();

API

getBingWallpaper(options?)

返回值类型为 Promise<BingWallpaperData>

import { getBingWallpaper } from "bing-wallpaper-api";

const today = await getBingWallpaper();
const yesterday = await getBingWallpaper({ index: 1 });
const specific = await getBingWallpaper({ date: "2026-03-01" });
const usWallpaper = await getBingWallpaper({ market: "en-US" });

clearBingWallpaperCache()

清空库内部的内存缓存,适合长生命周期进程主动回收。

import { clearBingWallpaperCache } from "bing-wallpaper-api";

clearBingWallpaperCache();

类型

import dayjs from "dayjs";

interface BingWallpaperOptions {
  date?: Date | dayjs.Dayjs | string;
  timezone?: string;
  resolution?:
    | "UHD"
    | "1920x1200"
    | "1920x1080"
    | "1366x768"
    | "1280x768"
    | "1024x768"
    | "800x600"
    | "800x480"
    | "768x1280"
    | "720x1280"
    | "640x480"
    | "480x800"
    | "400x240"
    | "320x240"
    | "240x320";
  market?: "zh-CN" | "en-US" | "ja-JP" | "en-AU" | "en-GB" | "de-DE" | "en-NZ" | "en-CA";
  index?: number;
}

interface BingWallpaperData {
  url: string;
  title: string;
  copyright: string;
  copyrightlink?: string;
  startdate: string;
  urlbase: string;
}

说明

  • index 仅支持 0-7
  • dateindex 不能同时传入
  • 当传入 date 时,会按指定时区计算与“今天”的天数差
  • 备用数据源仅用于默认市场下的“今日壁纸”场景,避免回退时返回错误日期或错误市场的数据

开发

pnpm install
pnpm run build
pnpm run test

License

MIT