git-cat-file
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

git-cat-file

Node.js CI npm version

Pure JavaScript git cat-file -p for node.js

SYNOPSIS

const {openLocalRepo} = require("git-cat-file");

async function catFile(revision, path) {
  const repo = openLocalRepo("repository/.git");
  const commit = await repo.getCommit(revision);
  const file = await commit.getFile(path);
  process.stdout.write(file.data);
}

catFile("HEAD", "path/to/file.txt");

CLI

Usage:
  git-cat-file-js [-C path] [-t | -p] <object>
  git-ls-tree-js [-C path] [<options>] <tree-ish> [<path>...]
  git-rev-parse-js [-C path] <args>...

Bundled CLI commands are also available via the git command.

npm install git-cat-file
export PATH=node_modules/.bin:$PATH
git cat-file-js [-t | -p] <object>
git ls-tree-js [<options>] <tree-ish> [<path>...]
git rev-parse-js <args>...

LINKS

/git-cat-file/

    Package Sidebar

    Install

    npm i git-cat-file

    Weekly Downloads

    49

    Version

    0.3.0

    License

    MIT

    Unpacked Size

    41.1 kB

    Total Files

    22

    Last publish

    Collaborators

    • kawanet