Registry / storage / gdrive-file-info

gdrive-file-info

JSON →
library1.2.0jsnpmunverified

A library to fetch metadata for publicly shared Google Drive items, version 1.2.0. It takes a Google Drive URL or file ID and returns information such as filename, size, download URL, thumbnail, and scan status. Releases are infrequent; the last update was in 2020. Unlike other Google Drive API wrappers, this does not require authentication and works solely with publicly shared files. It uses a lightweight approach with no external runtime dependencies beyond Node.js built-in fetch (or polyfill). The library is ESM-only since version 1.x.

storage
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

This package is ESM-only; require will fail.

import { fetchInfo } from 'gdrive-file-info';

Named export, not default.

import { GDriveError } from 'gdrive-file-info';

Exported cache object for manual clearing; not documented in README.

import { FILE_INFO_CACHE } from 'gdrive-file-info';

Fetches metadata for a publicly shared Google Drive file and logs its properties.

import { fetchInfo, GDriveError } from 'gdrive-file-info'; async function main() { const fileId = '1ObJEVgO6Y4cFjfxszUb1LhdyeKrq_wGD'; const url = `https://drive.google.com/open?id=${fileId}`; try { const info = await fetchInfo(url); console.log('Filename:', info.fileName); console.log('Size:', info.sizeBytes); console.log('Download URL:', info.downloadUrl); console.log('Scan result:', info.scanResult); const thumb = await info.thumbnailUrl({ width: 320, height: 240 }); console.log('Thumbnail:', thumb); } catch (err) { if (err instanceof GDriveError) { console.error('Drive error:', err.message); } else { console.error('Error:', err); } } } main();
Debug
Known footguns
gotchafetchInfo requires a publicly shared file; private files throw GDriveError.
gotchaThe thumbnailUrl method returns empty string for files without a thumbnail (e.g., non-image files).
breakingVersion 1.0.0 removed support for Node.js <10 and switched to ESM-only.
deprecatedThe 'thumbnailUrl' property was a function returning a Promise in v1, but in earlier beta versions it was synchronous. This is only relevant for developers upgrading from pre-1.0.0.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
19 hits · last 30 days
gptbot
3
amazonbot
3
bytedance
2
bingbot
1
ahrefsbot
1
Resources