Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

FR: Support direct lookup of Storage objects by `metadata.id`

Abierto
#2,939 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
google-cloud, node.js, typescript
Área
api, backend, cloud

Línea de trabajo

Comienza con la clase Bucket del Admin SDK y rastrea cómo crea referencias a archivos; compara ese recorrido con el cliente subyacente @google-cloud/storage mencionado en el issue. Define cómo se admitiría una búsqueda de metadata.id y, después, verifica que el objeto devuelto admita getMetadata(), download() y getSignedUrl(), igual que bucket.file(path).

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

type: feature request

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.custom and 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.
Lenguaje dominante
TypeScript
Estrellas
1.7k
Forks
419
Merge medio
4 d 20 h
PR fusionados (30 d)
16

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de firebase/firebase-admin-node

Todos los issues de firebase/firebase-admin-node

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.