A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/riboseinc/isogit-lfs below:

riboseinc/isogit-lfs: LFS helpers on top of Isomorphic Git by Ribose

Aspirationally, a set of helpers to simplify working with Git LFS through Isomorphic Git.

Currently the API is fairly low-level and verbose, which could be improved.

However, touching working directory is out of scope. Callers are free to integrate the library into workflows based on bare Git repositories or repositories with working directories depending on their specifics.

Note

While Isomorphic Git maintenance status is unclear, this library is in turn not likely to receive new features.

Peer dependencies:

Example of using the library to read from LFS:

import { pointsToLFS } from '@riboseinc/isogit-lfs/util.js';
import { readPointer, downloadBlobFromPointer } from '@riboseinc/isogit-lfs';

// We need to know the remote URL of this repository
// in order to request LFS data
// (this relies on Git config just for the sake of example)
const remoteURL = await git.getConfig({ fs, gitdir, path: 'remote.origin.url' });

/**
 * Read data for an object in given repository (`gitdir`)
 * at particular commit (`oid`)
 * at particular repository-relative path (`path`)
 * using supplied filesystem implementation (`fs`).
 *
 * Different from `readBlob()` in that it also handles
 * LFS, downloading & caching objects automatically.
 */
async function readObject(fs, gitdir, oid, path): Promise<Uint8Array> {

  // 1) Read some blob from the repo
  const gitObject = await git.readBlob({ fs, gitdir, oid, filepath: path });

  // 2) Check if this blob points to LFS
  if (pointsToLFS(gitObject.blob)) {

    // If yes, 3) deserialize pointer
    const pointer = readPointer({
      gitdir,
      content: gitObject.blob,
    });

    // 4) Download or retrieve from cache
    return await downloadBlobFromPointer({
      fs,
      url: remoteURL,
      http,
    }, pointer);

  } else {
    // If not, just return the blob straight away
    return gitObject.blob;
  }

}

As of 0.2.0, API offers the following functions (where blobs are Uint8Array instances you obtain from or give to Isomorphic Git):

Lower-level functions you probably won’t need to call:


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4