git-filesystem / git-filesystem.js

A shared abstraction for cloud Git providers exposing a file-system-like API written in TypeScript. Read & write to GitHub/GitLab/Bitbucket repositories like they're file systems.

Home Page:https://git-filesystem.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

git-filesystem

A shared abstraction for cloud Git providers exposing a file-system-like API. Use this to read & write to repositories like they're file systems.

Supports:

  • GitHub 🚧
  • GitLab 🚧
  • BitBucket 🚧

Exposes methods for:

  • Creating a repository

  • Deleting a repository

  • Searching for repositories

  • Creating a file

  • Overwriting a file

  • Deleting a file

  • Creating tags

  • Reading files from tags

Installation

npm install git-filesystem

Example Usage

import { ClientFactory } from "git-filesystem";

const gitHubClient = new ClientFactory().getClientForProvider(
  "github",
  "github-username",
  "access-token",
  "user-agent-name"
);
// or
const gitLabClient = new ClientFactory().getClientForProvider(
  "gitlab",
  "gitlab-username",
  "access-token",
  "user-agent-name"
);
// or
const bitBucketClient = new ClientFactory().getClientForProvider(
  "bitbucket",
  "bitbucket-username",
  "access-token",
  "user-agent-name"
);

// and then

const gitHubRepository = gitHubClient.getRepository("repository-name");

let fileContent = await gitHubRepository.readFile("file/path.txt");
fileContent += "\n\nNewData";

await gitHubRepository.updateFile("file/path.txt", fileContent);

License

git-filesystem is licensed under the ISC License.

About

A shared abstraction for cloud Git providers exposing a file-system-like API written in TypeScript. Read & write to GitHub/GitLab/Bitbucket repositories like they're file systems.

https://git-filesystem.github.io

License:ISC License


Languages

Language:TypeScript 99.9%Language:JavaScript 0.1%