git-clone-client
v0.0.6
Published
No dependency, no file-system Git shallow clone client for Node.js
Downloads
3
Readme
git-clone-client
No dependency, no file-system Git shallow clone client for Node.js
import { shallowCloneRef, httpFetchUsing } from 'git-clone-client';
async function handleRequest(req, res) {
const files = await shallowCloneRef('refs/heads/main', {
// Provide fetching method
makeRequest: fetchRepository('https://github.com/probeiuscorp/git-clone-client.git'),
// Partial clone -- only fetch files in the src/ directory
filter: (filepath) => filepath.startsWith('src/'),
});
}
// Use conveniently provided HTTP util, in this case with your environment's fetch method.
// Write your own to request over git://, ssh:// or whatever!
const fetchRepository = httpFetchUsing(fetch);
[!NOTE] This package uses node:zlib, node:crypto and node:buffer. To use different packages, fork and change imports of
src/git-objects.ts
.