Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Node bindings to the libgit2 project.
![Build Status] (https://travis-ci.org/nodegit/nodegit.svg) ![Build status] (https://ci.appveyor.com/api/projects/status/e5a5q75l9yfhnfv2?svg=true) ![Dependency Status] (https://david-dm.org/nodegit/nodegit.svg)
![Gitter](https://badges.gitter.im/Join Chat.svg)
Stable: 0.2.5
Tim Branyen @tbranyen, John Haley @johnhaley81, and Max Korp @maxkorp with help from awesome contributors!
Michael Robinson @codeofinterest, and Nick Kallen @nk
NodeGit will work on most systems out-of-the-box without any native dependencies.
npm install nodegit
If you encounter problems while installing, you should try the Building from source instructions below.
Minimum dependencies:
If you wish to help contribute to nodegit it is useful to build locally.
# Fetch this project.
git clone git://github.com/nodegit/nodegit.git
# Enter the repository.
cd nodegit
# Installs the template engine, run the code generation script, and build.
npm install
If you encounter errors, you most likely have not configured the dependencies correctly.
In order to track down possible bugs, you will need a debug buid so you can get a backtrace with gdb or lldb.
In order to do so, follow these steps:
BUILD_ONLY=true npm install
, or BUILD_ONLY=true npm link .
if
you are into itrm -rf build/Release
node-gyp configure --debug
node-gyp build --debug
Using APT in Ubuntu:
sudo apt-get install build-essential
Using Pacman in Arch Linux:
sudo pacman -S base-devel
You may have to add a build flag to the installation process to successfully install. Try first without, if the build fails, try again with the flag.
Allegedly the order in which you install Visual Studio could trigger this error.
npm install nodegit --msvs_version=2013
# Or whatever version you've installed.
var clone = require("./").Clone.clone;
// Clone a given repository into a specific folder.
clone("https://github.com/nodegit/nodegit", "tmp", null)
// Look up this known commit.
.then(function(repo) {
// Use a known commit sha from this repository.
return repo.getCommit("59b20b8d5c6ff8d09518454d4dd8b7b30f095ab5");
})
// Look up a specific file within that commit.
.then(function(commit) {
return commit.getEntry("README.md");
})
// Get the blob contents from the file.
.then(function(entry) {
// Patch the blob to contain a reference to the entry.
return entry.getBlob().then(function(blob) {
blob.entry = entry;
return blob;
});
})
// Display information about the blob.
.then(function(blob) {
// Show the name, sha, and filesize in byes.
console.log(blob.entry.name() + blob.entry.sha() + blob.size() + "b");
// Show a spacer.
console.log(Array(72).join("=") + "\n\n");
// Show the entire file.
console.log(String(blob));
})
.catch(function(err) { console.log(err); });
var open = require("nodegit").Repository.open;
// Open the repository directory.
open("tmp")
// Open the master branch.
.then(function(repo) {
return repo.getMasterCommit();
})
// Display information about commits on master.
.then(function(firstCommitOnMaster) {
// Create a new history event emitter.
var history = firstCommitOnMaster.history();
// Create a counter to only show up to 9 entries.
var count = 0;
// Listen for commit events from the history.
history.on("commit", function(commit) {
// Disregard commits past 9.
if (++count >= 9) {
return;
}
// Show the commit sha.
console.log("commit " + commit.sha());
// Store the author object.
var author = commit.author();
// Display author information.
console.log("Author:\t" + author.name() + " <", author.email() + ">");
// Show the commit date.
console.log("Date:\t" + commit.date());
// Give some space and show the message.
console.log("\n " + commit.message());
});
// Start emitting events.
history.start();
});
You will need to build locally before running the tests. See above.
npm test
The bump from 0.1.4 to 0.2.0 was a big one. Many things changed, see here: https://github.com/nodegit/nodegit/compare/refs/tags/0.1.4...0.2.0
This update is wholly and entirely a breaking one, and older versions won't be maintained. For the purpose of migration, perhaps the biggest point to make is that async methods can now use promises, rather than just taking callbacks. Additionally, lots of method and property names have changed.
A common issue is with nodegit not functioning properly inside of
node-webkit applications. Because nodegit
is a native module, it has to be rebuilt for node-webkit using
nw-gyp. By default, nodegit will look in the root package's package.json for an engines
property, and within look for a node-webkit
property that holds a specific version of node-webkit. The value of this property is what will get passed as the --target
argument to nw-gyp configure
.
Currently, support for node-webkit is limited, although we intend to support it better in the future.
<a name="v0-2-5" href="#v0-2-5">v0.2.5</a> (2015-01-20)
Closed issues:
Lookup a non existent commit crashes the process. #353
Why node-git uses 90% rotated hexagon? #344
Needed pull example or help with code #341
Can't require nodegit without building it explicitly #340
Tracking down bugs #331
Document possible values of CloneOptions #330
Require generating error #329
Failed getting Banner #328
Documentation broken #327
Fetch doesn't seem to work with https urls. #322
Merged pull requests:
Commit.getParents working with merge commits #357 (bjornarg)
Fixed a typo in the debug build instruction. #356 (mcollina)
[WIP] Attempt at fixing appveyor #352 (johnhaley81)
Updated to nan 1.5.0 and fixed build errors #351 (johnhaley81)
Added checkout head method and tests #347 (johnhaley81)
bump devDependencies #346 (PeterDaveHello)
Update dependency node-pre-gyp to ~0.6 #345 (PeterDaveHello)
Update dependency fs-extra to ~0.14.0 #343 (PeterDaveHello)
Add Dependency badge in readme #342 (PeterDaveHello)
Fixed promise chain on install #339 (johnhaley81)
Use svg instead of png to get better image quality #337 (PeterDaveHello)
Update to libgit 0.21.4 #336 (johnhaley81)
Fix issue 333 #334 (johnhaley81)
FAQs
Node.js libgit2 asynchronous native bindings
The npm package nodegit receives a total of 48,700 weekly downloads. As such, nodegit popularity was classified as popular.
We found that nodegit demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.