- Fahimtar abin da metadata Drive ke gudanarwa (suna, tags, indexableText, da thumbnails) da abin da metadata ke mallakar sauran ayyukan Google Cloud.
- Yi amfani da API ɗin Drive don tambaya da daidaita metadata; tsaftace EXIF da bayanan da aka saka kafin loda fayiloli.
- Mutunta iyaka da ƙa'idodi (bidiyo, rubutu mai ma'ana, kari) da kuma inganta tare da gcloud don gwajin REST na gida.
Kuna son sarrafa metadata na fayilolinku a ciki Google Drive kuma baku san ta ina zan fara ba? Anan mun yi bayani dalla-dalla. Yadda ake cire metadata a cikin Google Drive yadda ya kamata da aminci ( metadata na fayilolin da aka ɗora). Mun kuma gaya muku iyakar abin da Google ya ƙulla akan sunayen fayil, girma, da izini.
Wannan jagorar za ta ba ku cikakkiyar fahimtar abin da za a iya (kuma ba za a iya) "share" ba idan ya zo ga metadata a cikin Google Drive.
Abin da za a iya canza ko "share" a cikin Drive
Waɗannan su ne metadata za a iya cirewa daga fayilolin da aka ɗora zuwa Google Drive:
Suna da tsawo: Lokacin ƙirƙirar fayil ta hanyar API, yana da kyau a ƙayyade tsawo a cikin filin suna, misali, "cat.jpg." Driver na iya fahimtar tsawo daga nau'in MIME idan ba ku fayyace shi ba, amma yana da kyau ku ayyana shi da kanku. A cikin martanin da ke gaba, fayil ɗin karantawa kawai na iya bayyana tare da tsawo da aka cika daga suna. Idan mai amfani ya sauke fayil ɗin, Drive yana tattara sunan ƙarshe daga take (da tsawo).
- Rubutun da za a iya ƙididdigewa (contentHints.indexableText): Fitar da takaddun gama gari da nau'ikan (PDFs, hotuna masu kunna OCR, da sauransu) ta tsohuwa. Idan app ɗinku yana adana wasu nau'ikan tsari (zane, bidiyo, gajerun hanyoyi), zaku iya samar da rubutu mai ma'ana don inganta bincike. Ana sarrafa wannan rubutun azaman HTML: idan kun wuce kirtani mai ɗauke da tags, ana yin lissafin abubuwan da ke cikin rubutu, ba alamun alamar ba. Akwai iyakar girman 128KB don abun cikiHints.indexableText, kuma ana ba da shawarar cewa ka sabunta shi akan kowane ajiyar kuma kiyaye shi dacewa da fayil ɗin.
- Thumbnails (contentHints.thumbnail): Drive yana haifar da ƙananan hotuna don nau'o'i da yawa, amma ga tsarin da ba sa samar da su ta atomatik, za ka iya loda naka lokacin da ka ƙirƙiri ko sabunta fayil ɗin. Dole ne ku saita hoton zuwa URL-amintaccen base64 da madaidaicin mimeType. Maɓalli na ƙa'idodi: Tsarin tallafi sune PNG, GIF, ko JPG; Nisa shawarar shine 1600px (mafi ƙarancin 220px), kuma matsakaicin girman shine 2MB. Hotunan hotuna sun lalace lokacin da abun cikin fayil ya canza; metadata canje-canje ba.
- Samun dama ga manyan hotuna: Filin ThumbnailLink yana dawo da gajeriyar URL, ana samun dama ce kawai idan app ɗin yana da izinin karanta fayil ɗin (idan ba na jama'a ba, kuna buƙatar buƙace shi tare da takaddun shaida). Kuna iya tambayarsa don takamaiman fayil ko don jerin da aka tace ta nau'in.
- Lakabi: Drive yana ba ku damar haɗa lakabi da fayiloli. Don gano su, zaka iya amfani da fayiloli.listLabels, kuma don gyara su, dole ne ka yi la'akari da lakabin Id mai dacewa da fileId. Wannan tsarin yana da amfani don rarrabawa kuma, idan ya cancanta, "tsabta" rabe-raben da ba'a so ba tare da taɓa abun ciki ba.
Share metadata a cikin Google Drive: “boye” metadata daga fayil ɗin kanta
Babu maɓallin sihiri don cire metadata a cikin Google Drive (kamar EXIF a cikin hotuna ko bayanan da aka saka a cikin PDFs). Drive yana sarrafa nasa metadata, amma metadata da ke cikin fayil ɗin ya dogara da kayan aikin da ya ƙirƙira shi.
Shawarar aikin shine tsaftace fayil ɗin kafin loda shi zuwa Drive, Yin amfani da kayan aikin tsarin ko ƙa'idodi na musamman waɗanda ke cire bayanan EXIF daga hotuna ko kaddarorin takardu. Ta wannan hanyar, abun cikin da kuka ajiye a Drive ya isa "tsaftace."
Idan kuna da fayilolin da aka ɗora tare da bayanan metadata, maimakon cire metadata a cikin Google Drive, ya fi dacewa. zazzagewa, tsaftacewa da sake saukewa, maye gurbin asali idan an zartar. Tare da PDFs ko hotuna, wannan na kowa lokacin da kake son kare marubuci, wuri, ko tarihin gyarawa.
Don takamaiman ɓangaren Drive, mayar da hankali kan daidaita suna, alamomi da abun ciki Alamu (Text/thumbnail), waɗanda ke ƙarƙashin ikon ku. Idan kuma kuna sarrafa izinin shiga, kuna kuma rage fallasa bayanan metadata (misali, hanyoyin haɗin thumbnail masu isa ga waɗanda ke da haƙƙin karatu).
Kar ka manta da hakan Canza metadata na Drive kawai baya cire EXIF ko kaddarorin ciki. Don haka, dabarun ku yakamata ya haɗa fayil ɗin kafin-tsaftar tare da ingantaccen sarrafa metadata wanda Drive ke ba ku damar taɓawa.
Abubuwan da aka saba ruɗewa a cikin Google Cloud: VMs, gcloud, da iyaka
Idan kuna aiki tare da Google Cloud, zaku ga da yawa jagororin game da “metadata” waɗanda a zahiri suna nufin Injin Lissafi ko Ajiyayyen girgije, ba Drive ba. Duk da haka, za ku so ku san waɗannan abubuwan don kada ku gauraye su yayin bincike.
Asalin tsarin gcloud CLI
Bayan shigar da Google Cloud CLI, fara da:
gcloud init
Yana da mahimmanci don tabbatar da cewa kuna da sabon sigar tare da:
gcloud components update
Idan kuna amfani da mai ba da shaida na waje, Shiga tare da asalin tarayya kafin aiki tare da gcloud, musamman idan za ku tantance don yin kiran REST daga mahallin gida. Samfuran API na REST na iya amfani da takaddun shaidar da kuka tsara a cikin gcloud.
VMs
Izini da matsayin (Injin Lissafi): Don ƙara, sabuntawa, ko share metadata na al'ada akan VMs, kuna buƙatar izinin IAM masu dacewa. Misalai na gama-gari sun haɗa da:
- Idan VM naku suna amfani da asusun sabis: izinin
iam.serviceAccounts.actAsa cikin sabis ko asusun aikin. - metadata na aikin:
compute.projects.getycompute.projects.setCommonInstanceMetadata. - metadata na yanki:
compute.instanceSettings.getycompute.instanceSettings.updatedon yankin da ya dace. - Misali metadata:
compute.instances.getycompute.instances.setMetadata.
Iyakokin
Waɗannan su ne manyan iyakoki da muka ci karo da su yayin ƙoƙarin cire metadata a cikin Google Drive:
- Iyakance Girman (Injin Lissafi): Haɗaɗɗen shigarwar metadata an saita shi a 512 KB. Kowane maɓalli yana iyakance ga bytes 128, kuma kowane ƙima yana iyakance zuwa 256 KB. Idan, alal misali, kun yi amfani da maɓallin ssh-keys kuma ku wuce iyakar 256 KB, ba za ku iya ƙara ƙarin maɓalli ba har sai kun tsaftace.
- Babban harka da ƙarami: Maɓallai suna da hankali; dabi'u ma, ban da Booleans. A cikin zonal, ba za ku iya ƙirƙirar maɓallai biyu waɗanda suka bambanta kawai a yanayin (zonal-metadata-key vs. ZONAL-METADATA-KEY).
- metadata na yanki: an saita ko cire su ta amfani da gcloud ko REST. Ba za ku iya bayyana ƙimar shiyya don maɓallan SSH (ssh-keys). A cikin aikin ma'ana/ directory, idan akwai matakin-aiki da ƙimar shiyya don maɓalli iri ɗaya, ƙimar shiyya tana kan gaba a yankinta.
- Ƙimar boolean masu goyan baya: Baya ga GASKIYA/KARYA, zaku iya amfani da Y/Yes/1 da N/A'a/0 (matsalar rashin jin daɗi).
- Matsakaicin Kanfigareshan (Injin Lissafi):
- Tsara: metadata gama gari ga duk VMs a cikin aikin.
- Shiyya: shigarwar da suka shafi duk VMs a cikin wani yanki na musamman kuma suna iya ƙetare ƙimar aikin.
- Misali: metadata don takamaiman VM (ana ƙirƙira ko riga ya kasance).

Tambayoyi, ƙididdiga, da dawo da metadata a cikin Drive (REST da mafi kyawun ayyuka)
Bari yanzu mu kalli rawar takaitaccen siffofi lokacin cire metadata a cikin Google Drive. Kuma kuma hanya mafi kyau don dawo da su:
- Tabbaci ga REST kan-gidaje: Idan kuna gwada misalan REST daga injin ku, yi amfani da takaddun shaidar da aka saita tare da gcloud. Ta wannan hanyar, kiran API ɗin Drive ɗin ku zai mutunta ainihi da izini da kuka riga kun saita.
- Load da babban ɗan yatsa na al'ada: saita abun ciki Alamu.thumbnail tare da filaye biyu: URL-amintaccen hoton tushe64 da madaidaicin mimeType. Idan Drive ɗin zai iya samar da thumbnail ta atomatik, zai yi amfani da nasa kuma ya tsallake naku. In ba haka ba, zai yi amfani da wanda kuka bayar.
Maɓalli na ƙa'idodi don babban hoto a cikin Drive:
- Formats: PNG, GIF ko JPG.
- Nisa da aka ba da shawarar: 1600 px (mafi ƙarancin 220 px).
- Matsakaicin girman: 2MB.
- Sabunta thumbnail tare da kowane ajiyewa idan har yanzu yana da dacewa.
Muhimmanci game da rashin inganci: Hotunan hotuna sun lalace lokacin da aka canza abin da ke cikin fayil ɗin; metadata canje-canje ba. Idan kawai ka canza tags ko sunan, kar ka yi tsammanin sabon babban ɗan takaitaccen bayani sai dai in ka gyara fayil ɗin.
Rubutun da za a iya ƙididdigewa
Kada ku yi ƙoƙarin "wauta" binciken tare da kalmomi masu zafi. Ɗauki ra'ayoyi da sharuddan da mai amfani zai bincika cikin haƙiƙa don wannan fayil ɗin, kuma duba iyakar 128KB. Sabunta shi a duk lokacin da abun ciki ya canza sosai.
Aiwatar da daidaitattun sunaye da kariA duk lokacin da zai yiwu, haɗa da tsawo a cikin sunan lokacin lodawa; Idan ya ɓace, Drive zai yi ƙoƙarin fahimtar shi ta MIME. Tsare sunaye a bayyane zai guje wa shubuha kuma yana ba da damar ƙarin bincike mai sauƙi.
Tags a cikin Drive
Don gyara lakabi, lura da masu gano masu mahimmanci. Kuna buƙatar lakabin lakabinId da fileId na fayil. Kuna iya fara jera su da fayiloli.listLabels sannan kuyi amfani da sauye-sauye masu dacewa ga fayil ɗin manufa.
// Al modificar etiquetas de un archivo en Drive:
// - labelId: identificador de la etiqueta a cambiar
// - fileId: identificador del archivo al que aplicas la etiqueta
// Usa files.listLabels para localizarlas antes de actualizar.
Ka tuna cewa, Ko da yake Drive shine abin da aka mayar da hankali, yawancin ci gaba suna haɗa Drive tare da Cloud Storage ko wasu ayyuka, Don haka zaku ga misalan Ma'aji don bincika halayen abu.
// Ejemplo en Go para obtener atributos de un objeto en Cloud Storage (no Drive)
// e imprimir metadatos como ContentType, CacheControl, MD5, etc.
// Útil si tu flujo sube primero a Storage y luego a Drive.
import (
"context"
"fmt"
"io"
"time"
"cloud.google.com/go/storage"
)
func getMetadata(w io.Writer, bucket, object string) (*storage.ObjectAttrs, error) {
ctx := context.Background()
client, err := storage.NewClient(ctx)
if err != nil { return nil, fmt.Errorf("storage.NewClient: %w", err) }
defer client.Close()
ctx, cancel := context.WithTimeout(ctx, 10*time.Second)
defer cancel()
o := client.Bucket(bucket).Object(object)
attrs, err := o.Attrs(ctx)
if err != nil { return nil, fmt.Errorf("Object(%q).Attrs: %w", object, err) }
fmt.Fprintf(w, "Bucket: %v\n", attrs.Bucket)
fmt.Fprintf(w, "CacheControl: %v\n", attrs.CacheControl)
fmt.Fprintf(w, "ContentDisposition: %v\n", attrs.ContentDisposition)
fmt.Fprintf(w, "ContentEncoding: %v\n", attrs.ContentEncoding)
fmt.Fprintf(w, "ContentLanguage: %v\n", attrs.ContentLanguage)
fmt.Fprintf(w, "ContentType: %v\n", attrs.ContentType)
fmt.Fprintf(w, "Crc32c: %v\n", attrs.CRC32C)
fmt.Fprintf(w, "Generation: %v\n", attrs.Generation)
fmt.Fprintf(w, "KmsKeyName: %v\n", attrs.KMSKeyName)
fmt.Fprintf(w, "Md5Hash: %v\n", attrs.MD5)
fmt.Fprintf(w, "MediaLink: %v\n", attrs.MediaLink)
fmt.Fprintf(w, "Metageneration: %v\n", attrs.Metageneration)
fmt.Fprintf(w, "Name: %v\n", attrs.Name)
fmt.Fprintf(w, "Size: %v\n", attrs.Size)
fmt.Fprintf(w, "StorageClass: %v\n", attrs.StorageClass)
fmt.Fprintf(w, "TimeCreated: %v\n", attrs.Created)
fmt.Fprintf(w, "Updated: %v\n", attrs.Updated)
fmt.Fprintf(w, "Event-based hold enabled? %t\n", attrs.EventBasedHold)
fmt.Fprintf(w, "Temporary hold enabled? %t\n", attrs.TemporaryHold)
fmt.Fprintf(w, "Retention expiration time %v\n", attrs.RetentionExpirationTime)
fmt.Fprintf(w, "Custom time %v\n", attrs.CustomTime)
fmt.Fprintf(w, "Retention: %+v\n", attrs.Retention)
fmt.Fprintf(w, "\n\nMetadata\n")
for key, value := range attrs.Metadata {
fmt.Fprintf(w, "\t%v = %v\n", key, value)
}
return attrs, nil
}
Share fayiloli vs. share metadata a cikin Google Drive
Idan abin da kuke so shi ne share fayil daga DriveA matsayin mai shi, zaku iya matsar da shi zuwa sharar daga gidan yanar gizo ta danna dama kuma zaɓi Matsar zuwa Sharar. Idan mai shi wani ne, za ku iya "Cire" fayil ɗin daga ganin ku; wasu kuma za su iya gani.
para Don share fayil ɗin dindindin, dole ne ku kwashe sharar ko amfani da zaɓin sharewa na dindindin, A wannan yanayin, ba za ku iya dawo da shi ba. Wannan, da kanta, baya "cire metadata" daga wasu fayiloli - yana aiki ne kawai ga abin.
Ba za ku iya share metadata a cikin Google Drive daga fayilolin da ba ku mallaka ba, saboda ikonsu na wanda ya halicce su ne ko kuma na wanda ke da babban izini a cikin kungiyar. A cikin waɗannan lokuta, kawai kuna cire damar ku ko ganuwa.
Danganta shi da metadata: Share fayil yana share metadata a cikin Drive tare da shi, amma baya shafar metadata a cikin wasu kwafi ko sanya metadata a cikin wasu takaddun da suka rage a cikin tsarin.
Tare da duk abubuwan da ke sama, yanzu zaku iya bambanta da kyau Me metadata Drive ke sarrafa (suna, tags, alamun bincike, da thumbnails), yadda ake tambayar su ta hanyar REST, waɗanne mafi kyawun ayyuka da za a bi don tsaftace bayanan da aka haɗa kafin lodawa, da waɗanne iyakoki da izini ke shiga cikin wasa lokacin da kuka ci karo da takaddun Google Cloud waɗanda ke magana game da “metadata” a cikin wasu mahallin.
Edita ya ƙware a fannin fasaha da al'amuran intanet tare da gogewa fiye da shekaru goma a cikin kafofin watsa labaru na dijital daban-daban. Na yi aiki a matsayin edita da mahaliccin abun ciki don kasuwancin e-commerce, sadarwa, tallan kan layi da kamfanonin talla. Na kuma yi rubutu a shafukan yanar gizo na tattalin arziki, kudi da sauran fannoni. Aikina kuma shine sha'awata. Yanzu, ta hanyar labarai na a ciki Tecnobits, Ina ƙoƙarin bincika duk labarai da sababbin damar da duniyar fasahar ke ba mu kowace rana don inganta rayuwarmu.