All Projects β†’ lukeed β†’ Gittar

lukeed / Gittar

Licence: mit
🎸 Download and/or Extract git repositories (GitHub, GitLab, BitBucket). Cross-platform and Offline-first!

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Gittar

Git Repo
Git-Repo: CLI utility to manage git services from your workspace
Stars: ✭ 818 (+840.23%)
Mutual labels:  gitlab, bitbucket
Scm Backup
Makes offline backups of your cloud hosted source code repositories
Stars: ✭ 38 (-56.32%)
Mutual labels:  gitlab, bitbucket
Casync
Content-Addressable Data Synchronization Tool
Stars: ✭ 890 (+922.99%)
Mutual labels:  archive, download
Git Copy History
Copy commit history from another repository
Stars: ✭ 84 (-3.45%)
Mutual labels:  gitlab, bitbucket
Spotify Onthego
Download Spotify playlists by searching for audio files on YouTube
Stars: ✭ 66 (-24.14%)
Mutual labels:  download, offline
Git Touch
An open-source app for GitHub, GitLab, Bitbucket, Gitea, and Gitee(码云), built with Flutter
Stars: ✭ 663 (+662.07%)
Mutual labels:  gitlab, bitbucket
Storage Based Queue
Javascript queue library with persistent storage based queue mechanism for the browsers environments. Specially designed for offline.
Stars: ✭ 33 (-62.07%)
Mutual labels:  offline-first, offline
Upup
✈️ Easily create sites that work offline as well as online
Stars: ✭ 4,777 (+5390.8%)
Mutual labels:  offline-first, offline
Web Archives
A web archives reader
Stars: ✭ 52 (-40.23%)
Mutual labels:  archive, offline
Download
Download and extract files
Stars: ✭ 1,064 (+1122.99%)
Mutual labels:  extract, download
Bootstrap4 Offline Docs
Bootstrap 4.4 offline documentation
Stars: ✭ 655 (+652.87%)
Mutual labels:  download, offline
Notes
Some public notes
Stars: ✭ 1,248 (+1334.48%)
Mutual labels:  gitlab, bitbucket
Sw Precache
Service Worker Precache is a module for generating a service worker that precaches resources. It integrates with your build process. Once configured, it detects all your static resources (HTML, JavaScript, CSS, images, etc.) and generates a hash of each file's contents. Information about each file's URL and versioned hash are stored in the generated service worker file, along with logic to serve those files cache-first, and automatically keep those files up to date when changes are detected in subsequent builds.
Stars: ✭ 5,276 (+5964.37%)
Mutual labels:  offline-first, offline
Scala Steward
πŸ€– A bot that helps you keep your Scala projects up-to-date
Stars: ✭ 812 (+833.33%)
Mutual labels:  gitlab, bitbucket
Webhooks
🎣 Webhook receiver for GitHub, Bitbucket, GitLab, Gogs
Stars: ✭ 601 (+590.8%)
Mutual labels:  gitlab, bitbucket
Trackdown
TrackDown - Issue Tracking with plain Markdown. If you are missing the "git clone" for your tickets from github.com or bitbucket.org, then this is for you. A lightweight Ticketing System for distributed and unconnected small Teams.
Stars: ✭ 10 (-88.51%)
Mutual labels:  gitlab, bitbucket
Vssue
πŸ“« A Vue-powered Issue-based Comment Plugin
Stars: ✭ 496 (+470.11%)
Mutual labels:  gitlab, bitbucket
Renovate
Universal dependency update tool that fits into your workflows.
Stars: ✭ 6,700 (+7601.15%)
Mutual labels:  gitlab, bitbucket
Tris Webpack Boilerplate
A Webpack boilerplate for static websites that has all the necessary modern tools and optimizations built-in. Score a perfect 10/10 on performance.
Stars: ✭ 1,016 (+1067.82%)
Mutual labels:  offline-first, offline
Export Pull Requests
Export pull requests and/or issues to a CSV file. Supports GitHub, GitLab, and Bitbucket
Stars: ✭ 68 (-21.84%)
Mutual labels:  gitlab, bitbucket

gittar TravisCI Status AppVeyor Status

🎸 Download and/or Extract git repositories (GitHub, GitLab, BitBucket). Cross-platform and Offline-first!

Gittar is a Promise-based API that downloads *.tar.gz files from GitHub, GitLab, and BitBucket.

All archives are saved to the $HOME/.gittar directory with the following structure:

{HOSTNAME}/{USER}/{REPO}/{BRANCH-TAG}.tar.gz
#=> github/lukeed/mri/v1.1.0.tar.gz
#=> gitlab/Rich-Harris/buble/v0.15.2.tar.gz
#=> github/vuejs-templates/pwa/master.tar.gz

By default, new gittar.fetch requests will check the local filesystem for a matching tarball before intiating a new remote download!

Important: Please see gittar.fetch for exceptions & behaviors!

Install

$ npm install --save gittar

Usage

const gittar = require('gittar');

gittar.fetch('lukeed/gittar').then(console.log);
//=> ~/.gittar/github/lukeed/gittar/master.tar.gz

gittar.fetch('lukeed/tinydate#v1.0.0').then(console.log);
//=> ~/.gittar/github/lukeed/tinydate/v1.0.0.tar.gz

gittar.fetch('https://github.com/lukeed/mri').then(console.log);
//=> ~/.gittar/github/lukeed/mri/master.tar.gz

gittar.fetch('gitlab:Rich-Harris/buble#v0.15.2').then(console.log);
//=> ~/.gittar/gitlab/Rich-Harris/buble/v0.15.2.tar.gz

gittar.fetch('Rich-Harris/buble', { host:'gitlab' }).then(console.log);
//=> ~/.gittar/gitlab/Rich-Harris/buble/master.tar.gz

const src = '...local file or repo pattern...';
const dest = '/path/to/foobar';

gittar.extract(src, dest, {
  filter(path, entry) {
    if (path.includes('package.json')) {
      let pkg = '';
      entry.on('data', x => pkg += x).on('end', _ => {
        const devDeps = JSON.parse(pkg).devDependencies || {};
        console.log('~> new devDependencies:', Object.keys(devDeps));
      });
    }

    if (path.includes('.babelrc')) {
      return false; // ignore this file!
    }

    return true; // keep all other files
  }
});

API

gittar.fetch(repo, options)

Type: Promise
Returns: String

Behavior

Parses the repo name, then looks for matching tarball on filesystem. Otherwise, a HTTPS request is dispatched and then, if successful, the archive is saved to ~/.gittar at the appropriate path.

Exceptions

  • If Gittar detects that your machine is not connected to the internet, or if useCache is true, then it will only attempt a local fetch.
  • If repo is (or is assumed to be) a master branch, or if force is true, then the archive will be downloaded over HTTPS before checking local cache.

repo

Type: String

The name, link, or pattern for a git repository.

Optionally provide a tag or branch name, otherwise master is assumed.

parse('user/repo');
//=> ~/.gittar/github/user/repo/master.tar.gz
//=> https://github.com/user/repo/archive/master.tar.gz

parse('user/repo#v1.0.0');
//=> ~/.gittar/github/user/repo/v1.0.0.tar.gz
//=> https://github.com/user/repo/archive/v1.0.0.tar.gz

parse('user/repo#production');
//=> ~/.gittar/github/user/repo/production.tar.gz
//=> https://github.com/user/repo/archive/production.tar.gz

parse('bitbucket:user/repo');
//=> ~/.gittar/bitbucket/user/repo/master.tar.gz
//=> https://bitbucket.org/user/repo/get/master.tar.gz

parse('https://gitlab.com/user/repo');
//=> ~/.gittar/gitlab/user/repo/master.tar.gz
//=> https://gitlab.com/user/repo/repository/archive.tar.gz?ref=master

Note: The parse function does not exist -- it's only demonstrating the parsed values of the varying patterns.

options.host

Type: String
Default: github

The hostname for the repository.

Specifying a "hint" in the repo will take precedence over this value.

fetch('gitlab:user/repo', { host:'bitbucket' });
//=> ~/.gittar/gitlab/user/repo/master.tar.gz
//=> https://gitlab.com/user/repo/repository/archive.tar.gz?ref=master

options.force

Type: Boolean
Default: false

Force a HTTPS download. If there is an error with the network request, a local/cache lookup will follow.

Note: A network request is also forced if the repo is (or is assumed to be) a master branch!

options.useCache

Type: Boolean
Default: false

Only attempt to use an existing, cached file. No network requests will be dispatched.

Note: Gittar enacts this option if it detects that there is no internet connectivity.

gittar.extract(file, target, options)

file

Type: String

A filepath to extract. Also accepts a repo pattern!

Important: A repo pattern will be parsed (internally) as a filepath. No network requests will be dispatched.

target

Type: String
Default: process.cwd()

The target directory to place the archive's contents.

Note: Value will be resolved (see path.resolve) if not already an absolute path.

options

Type: Object
Default: { strip:1 }

All options are passed directly to tar.extract.

Note: The cwd and file options are set for you and cannot be changed!

options.strip

Type: Integer
Default: 1

By default, gittar will strip the name of tarball from the extracted filepath.

const file = 'lukeed/mri#master';

// strip:1 (default)
gittar.extract(file, 'foo');
//=> contents: foo/**

// strip:0 (retain tarball name)
gittar.extract(file, 'foo', { strip:0 });
//=> contents: foo/mri-master/**

License

MIT Β© Luke Edwards

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].