{"id":18375425,"url":"https://github.com/riboseinc/isogit-lfs","last_synced_at":"2025-04-06T20:31:01.450Z","repository":{"id":56937794,"uuid":"431823905","full_name":"riboseinc/isogit-lfs","owner":"riboseinc","description":"LFS helpers on top of Isomorphic Git","archived":false,"fork":false,"pushed_at":"2024-12-04T12:35:44.000Z","size":137,"stargazers_count":7,"open_issues_count":1,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-05T23:32:28.183Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/riboseinc.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-11-25T11:41:43.000Z","updated_at":"2024-12-04T12:35:48.000Z","dependencies_parsed_at":"2022-08-21T06:50:20.638Z","dependency_job_id":"3b7621e8-0cac-489c-973d-1106302b9030","html_url":"https://github.com/riboseinc/isogit-lfs","commit_stats":{"total_commits":58,"total_committers":1,"mean_commits":58.0,"dds":0.0,"last_synced_commit":"575aace913f3811adcd735733ec86d71204c00bd"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riboseinc%2Fisogit-lfs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riboseinc%2Fisogit-lfs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riboseinc%2Fisogit-lfs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/riboseinc%2Fisogit-lfs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/riboseinc","download_url":"https://codeload.github.com/riboseinc/isogit-lfs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247547206,"owners_count":20956518,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-06T00:18:51.869Z","updated_at":"2025-04-06T20:31:01.445Z","avatar_url":"https://github.com/riboseinc.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"Aspirationally, a set of helpers\nto simplify working with Git LFS through Isomorphic Git.\n\nCurrently the API is fairly low-level and verbose,\nwhich could be improved.\n\nHowever, touching working directory is out of scope.\nCallers are free to integrate the library into workflows\nbased on bare Git repositories or repositories with working directories\ndepending on their specifics.\n\nNOTE: While Isomorphic Git maintenance status is unclear,\nthis library is in turn not likely to receive new features.\n\n\n== Installation\n\nPeer dependencies:\n\n- Isomorphic Git ^1.7.8\n- @aws-crypto/sha256-universal ^2.0.0\n\n\n== Usage\n\nExample of using the library to read from LFS:\n\n```typescript\nimport { pointsToLFS } from '@riboseinc/isogit-lfs/util.js';\nimport { readPointer, downloadBlobFromPointer } from '@riboseinc/isogit-lfs';\n\n// We need to know the remote URL of this repository\n// in order to request LFS data\n// (this relies on Git config just for the sake of example)\nconst remoteURL = await git.getConfig({ fs, gitdir, path: 'remote.origin.url' });\n\nasync function readObject(fs, gitdir, oid, path): Promise\u003cUint8Array\u003e {\n\n  // 1) Read some blob from the repo\n  const gitObject = await git.readBlob({ fs, gitdir, oid, filepath: path });\n  \n  // 2) Check if this blob points to LFS\n  if (pointsToLFS(gitObject.blob)) {\n\n    // If yes, 3) deserialize pointer\n    const pointer = readPointer({\n      gitdir,\n      content: gitObject.blob,\n    });\n\n    // 4) Download or retrieve from cache\n    return await downloadBlobFromPointer({\n      fs,\n      url: remoteURL,\n      http,\n    }, pointer);\n\n  } else {\n    // If not, just return the blob straight away\n    return gitObject.blob;\n  }\n\n}\n```\n\n== API\n\nAs of 0.2.0, API offers the following functions\n(blobs are Uint8Array instances):\n\n\n- `downloadBlobFromPointer({ http, headers, url, auth }, lfsPointer) =\u003e Promise\u003cUint8Array\u003e`\n+\nwhere `http` is an `HttpClient` as supported by Isomorphic Git,\nURL is repository URL\nand `lfsPointer` is an object returned by `readPointer()`.\n+\nUses LFS cache (which is hidden in Git repo structure,\nunder `.git/lfs` for non-bare repositories) if the object had been previously retrieved.\n\n\n- `uploadBlob({ http, headers, url, auth }, blob) =\u003e Promise\u003cPointerInfo\u003e`\n+\nwhere first argument is the same as for the download function,\nand returned pointer info can be used to write a pointer file in place\nof actual object in Git repository (pass it through `formatPointerInfo()`).\n\n\n- `readPointer({ gitdir, content }) =\u003e Pointer`\n+\nwhere `gitdir` behavior mimics that of Isomorphic Git\n(for non-bare repositories it’s *not* working directory but the `.git` in it)\nand `content` is a `Uint8Array`.\n+\nReturns an LFS pointer together with Git repo object path of the full blob\n(which may or may not be retrieved).\n\n\n- `readPointerInfo(blob) =\u003e PointerInfo`\n+\nconverts a Uint8Array into an LFS pointer structure\nsufficient for requesting actual LFS blob.\n\n\n- `formatPointerInfo(lfsPointerInfo) =\u003e Uint8Array`\n+\nconverts pointer info to appropriately formatted blob\nsuitable to be stored in Git repository in place of actual object data.\n\n\n- `populateCache(gitdir, ref?) =\u003e Promise\u003cvoid\u003e`\n+\nwhere `gitdir` is same as for `readPointer()`\nand `ref` should probably be left at the default `\"HEAD\"`.\n+\nAttempts to download all LFS objects in the tree of `ref`.\nDoes not return anything or write anything anywhere\nexcept lets the blobs be cached for subsequently faster invocations\nof the download function.\n+\nNOTE: This particular function is a very tentative piece of API.\nDownloads are not particularly optimized, it’s likely quite slow.\n\n- `utils.pointsToLFS({ gitdir, content }) =\u003e boolean`\n+\nwhere `gitdir` is same as for `readPointer()`\nand `content` is data of some object in the repository\nas `Uint8Array`.\n\n\n== Known shortcomings\n\n- The `@aws-crypto/sha256-universal` dependency is suboptimal.\nIt pulls extra dependencies of its own,\nwhile it’s not that difficult to provide corresponding implementation using subtle crypto\nwhich is compatible between Node and modern browsers.\n- Originally written for Node runtime, but should work in browser as of 0.2.0.\n- Lacks automated tests.\n\n== Considered within scope\n\n- Implement batch uploads and downloads (parallelise requests? use native batch API?)\n- Find a way to generalize UA header handling\n- Make it work in browser runtime as well (if feasible?) — should be done in 0.2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Friboseinc%2Fisogit-lfs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Friboseinc%2Fisogit-lfs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Friboseinc%2Fisogit-lfs/lists"}