FR: Support direct lookup of Storage objects by `metadata.id`
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- google-cloud, node.js, typescript
Hướng nghiên cứu
Bắt đầu với lớp Bucket của Admin SDK và truy vết cách lớp này tạo các tham chiếu đến tệp; so sánh đường đi đó với client @google-cloud/storage nền tảng được đề cập trong issue. Xác định cách hỗ trợ việc tra cứu metadata.id, sau đó xác minh rằng đối tượng được trả về hỗ trợ getMetadata(), download() và getSignedUrl() giống như bucket.file(path).
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Title:
FR: Support direct lookup of Storage objects by metadata.id
Is your feature request related to a problem? Please describe.
Currently in the Admin SDK there is no way to fetch a file reference directly by its internal metadata.id. Users must call bucket.getFiles() (optionally with a prefix) and then iterate through every file’s metadata until they find a match. This approach is painfully inefficient for buckets with hundreds or thousands of objects, and leads to high latency and extra egress charges just to resolve a single file by its ID.
Describe the solution you’d like
Add a first-class API—e.g.
const file = await bucket.fileById('ABCD1234-xyz');
under the Admin SDK’s Bucket class (and optionally in the underlying @google-cloud/storage client). Internally it could leverage a server-side lookup or index rather than requiring a full listing scan. The returned object should behave identically to bucket.file(path) so you can immediately call getMetadata(), download(), or getSignedUrl().
Describe alternatives you’ve considered
-
Client-side scan:
const [files] = await bucket.getFiles(); for (const f of files) { const [m] = await f.getMetadata(); if (m.id === targetId) return f; }
Works, but requires listing every object + extra round-trips.
- Storing custom metadata: You could save your own “id” in
metadata.customand index it in Firestore, but that duplicates what the server already knows, and still needs a separate database lookup.
Additional context
- This feature is especially important for multi-tenant or large-scale apps where buckets routinely hit thousands of files.
- Without it, reverse-lookup patterns become a maintenance burden and performance bottleneck.
- Screenshot of current workaround and templates attached.
- Ngôn ngữ chính
- TypeScript
- Star
- 1.7k
- Fork
- 419
- Merge trung bình
- 4 ngày 20 giờ
- Pull request đã merge (30 ngày)
- 16
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của firebase/firebase-admin-node
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
firebase/firebase-admin-node#3234 ·
-
firebase/firebase-admin-node#3221 · 3 bình luận · 1 người được giao ·
-
api: messaging
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 70/100
firebase/firebase-admin-node#3215 ·
-
api: messaging
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 28/100
firebase/firebase-admin-node#3214 ·
-
api: firestore type: feature request
firebase/firebase-admin-node#3183 · 1 bình luận · 1 người được giao ·
Tất cả issue của firebase/firebase-admin-node
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
mksglu/context-mode#1200 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
jaegertracing/jaeger-ui#4506 ·
-
area:desktop area:ui bug platform:macos
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
anthropics/claude-code#96687 ·
-
good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 95/100
AOSSIE-Org/DebateAI#582 · 2 bình luận ·