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.

npm install gdrive-file-info
INSTALL
IMPORT
SIG · GDRIVE-FILE-INFO
G
gdrive-file-info
storagejavascriptv1.2.0
harness data pending
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.

fetchInfo
import { fetchInfo } from 'gdrive-file-info';
const fetchInfo = require('gdrive-file-info');
This package is ESM-only; require will fail.
GDriveError
import { GDriveError } from 'gdrive-file-info';
import GDriveError from 'gdrive-file-info';
Named export, not default.
FILE_INFO_CACHE
import { FILE_INFO_CACHE } from 'gdrive-file-info';
Exported cache object for manual clearing; not documented in README.

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 issues
gotchafetchInfo requires a publicly shared file; private files throw GDriveError.
fix
Ensure the Google Drive item is shared with 'Anyone with the link can view'.
affects: >=1.0.0
gotchaThe thumbnailUrl method returns empty string for files without a thumbnail (e.g., non-image files).
fix
Check if thumbnailUrl returns a non-empty string before using it.
affects: >=1.0.0
breakingVersion 1.0.0 removed support for Node.js <10 and switched to ESM-only.
fix
Use Node.js 10+ and import syntax; require() is not supported.
affects: >=1.0.0
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.
fix
Use async/await with thumbnailUrl calls.
affects: <1.0.0
Errors
Common errors & fixes
Cannot find module 'gdrive-file-info'
The package is not installed or is installed in a non-module context (e.g., using require instead of import).
fix
Install with 'npm install gdrive-file-info' and use 'import { fetchInfo } from 'gdrive-file-info';'
TypeError: fetchInfo is not a function
Importing the package incorrectly, e.g., default import instead of named import.
fix
Use 'import { fetchInfo } from 'gdrive-file-info';' (named export).
GDriveError: HTTP error 404
The provided file ID or URL does not point to a valid publicly shared file.
fix
Check the URL/ID and ensure the file is shared publicly (Anyone with link can view).
TypeError: Invalid ID provided
The input string does not contain a valid Google Drive file ID.
fix
Provide a valid Google Drive share URL (e.g., https://drive.google.com/open?id=...) or a raw file ID.
Upgrade
Version history
1.2.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
23 hits · last 30 days
node
20
OpenAI (training)
1
Resources
gdrive-file-info — npm install gdrive-file-info · libregistry