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

google-drive-picker-plus

v1.1.0

Published

A modern, zero-dependency, TypeScript-friendly wrapper for Google Drive Picker API and OAuth2, enabling cross-platform file selection.

Readme

Google Drive Picker Plus

NPM version Build Status

English

一个现代化、零依赖、支持 TypeScript 的 Google Drive Picker API 和 OAuth2 封装库,帮助你在跨平台应用中无缝集成 Google Drive 文件选择功能。


✨ 功能特性

  • 现代 & 简单: 只需一个异步函数即可完成整个流程
  • TypeScript 优先: 100% 使用 TypeScript 编写,提供完善的类型定义。
  • 可配置化: 可自定义 MIME 类型、文件大小限制和选择模式。
  • 健壮的错误处理: 标准化错误对象,便于统一管理。
  • 多模块格式支持: 兼容 UMD、CJS、ESM,满足不同环境需求。

🚀 安装

pnpm add google-drive-picker-plus

💡 Usage

import { openGoogleDrivePicker, GooglePickerError } from 'google-drive-picker-plus';

async function selectFiles() {
  const options = {
    clientId: 'YOUR_GOOGLE_CLIENT_ID',
    apiKey: 'YOUR_GOOGLE_API_KEY',
    appId: 'YOUR_GOOGLE_APP_ID',
    // Optional configurations
    multiSelect: true,
    maxFileSizeMB: 10,
    mimeTypes: ['image/jpeg', 'image/png', 'application/pdf'],
  };

  try {
    const files = await openGoogleDrivePicker(options);
    console.log('Selected Files:', files);
    // Now you have an array of File objects to work with!
  } catch (error) {
    if (error instanceof GooglePickerError) {
      console.error('Picker Error:', error.code, error.message);
    } else {
      console.error('An unexpected error occurred:', error);
    }
  }
}

// Call the function when needed, e.g., on a button click
document.getElementById('my-button').addEventListener('click', selectFiles);

API 参考

openGoogleDrivePicker(options: PickerOptions): Promise<File[]>

options: PickerOptions 对象。

clientId: string:必填。你的 Google API Client ID。

apiKey: string:必填。你的 Google API Key。

appId: string:必填。你的 Google App ID。

mimeTypes?: string[]:可选。允许的 MIME 类型数组。

maxFileSizeMB?: number:可选。最大文件大小(单位:MB)。

multiSelect?: boolean:可选。是否允许多文件选择,默认为 true。

Error Handling

The function throws GooglePickerError for predictable errors. Each error instance has code and message properties.

| Code | Message | | ---------------------------- | ------------------------------------------------------ | | MISSING_CONFIG | Required configuration options are missing. | | SCRIPT_LOAD_FAILED | Failed to load Google API scripts. | | AUTH_FAILED | Authorization failed or was denied. | | USER_CANCELLED | User cancelled the file selection. | | FILE_SIZE_LIMIT_EXCEEDED | A selected file exceeds the size limit. | | ...and more | |