开发者

Has anyone implemented a git clone or interface library using nodejs? [closed]

开发者 https://www.devze.com 2023-03-04 18:45 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form. For help clari
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 10 years ago.

I'开发者_Python百科m looking for an implementation of git which is accessible from nodejs - does such a beast exist?


Looks like there are now several options for using git from node:

  • gift: simple Node.js wrapper for the Git CLI with an API based on Grit (npm / github)
  • node-git: a node.js git implementation modeled on grit (npm / github)
  • nodegit: libgit2 asynchronous native bindings (npm / github)
  • node-git: a thin wrapper around the command-line git command (github)


Note sure if there's a git library for Node but you can also just execute a shell process directly, example:

var sys = require('sys')
var exec = require('child_process').exec;
function puts(error, stdout, stderr) { sys.puts(stdout) }
exec("git status", puts);


there is also node-gitteh as libgit2 bindings, but both gitteh and christkv/node-git were not of the quality and completeness I needed

I wrote treeeater a spawn git wrapper, which is callable with plain javascript objects instead of strings, can parse some output (git log → commit objects, git ls-tree → tree object hierachy) and runs async. It is in active use and supports all git commands, atleast for calling them and piping their output chunk or line wise. You can stick to git man-pages to get the documentation to each command.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号