basalt / drives-google/src / toDriveItem
Function: toDriveItem()
> toDriveItem(file): DriveItem
Defined in: drives-google/src/metadata.ts:101
Maps one file.
Four decisions, each a place a vendor difference could have been flattened:
versionisheadRevisionId, not Google'sversionfield. Drive'sversionis a monotonic counter that moves on any change, a rename included;headRevisionIdmoves only when the bytes do. SincecontentVersion()prefersversionover the checksum, using Drive's counter would re-download a file every time someone renamed it. A file with noheadRevisionId(a native Doc, a folder) falls through to the checksum, which is content-exact, and then toupdatedAt.checksumis labelledmd5, honestly. Google publishes an MD5 of the stored bytes for binary files, and only for those. It is comparable with anyone else's MD5 of the same bytes, which is exactly why it must not be labelled anything else.- A native Doc is
exportOnly. Docs, Sheets, Slides and friends have nomd5Checksum, nosizeand no downloadable bytes at all:files.get ?alt=mediaanswers403 fileNotDownloadable. They are surfaced withexportOnly: trueand their mime type inraw, so an app can decide to runfiles.exportitself. Silently exporting them to some format the app never asked for would be the framework inventing a business decision. - There is no
path. Drive is a graph, not a tree: a file can have several parents, and a "path" is a display convention the API does not publish.parentIdcarries the first parent; anything path-shaped would be a fabrication, and the removal-by-path shape Dropbox needs is therefore not used here.