| Apr |
MAY |
Jun |
|
11 |
|
| 2020 |
2021 |
2022 |
About this capture
Web crawl data from Common Crawl.
The Wayback Machine - http://web.archive.org/web/20210511231232/https://www.nodegit.org/api/tree/
Latest release: 0.26.1
●Latest release: 0.26.1
●HEAD
●0.26.1
●0.26.0
●0.25.1
●0.25.0
●0.24.0
●0.24.0-alpha.1
●0.23.0
●0.23.0-alpha.2
●0.23.0-alpha.1
●0.22.2
●0.22.1
●0.22.0
●0.21.2
●0.21.1
●0.21.0
●0.20.3
●0.20.2
●0.20.0
●0.19.0
●0.18.0
●0.17.0
●0.16.0
●0.15.1
●0.14.1
●0.14.0
●0.13.2
●0.13.1
●0.13.0
●0.12.2
●0.12.1
●0.12.0
●0.11.9
●0.11.8
●0.11.7
●0.11.6
●0.11.5
●0.11.4
●0.11.3
●0.11.2
●0.11.1
●0.11.0
●0.10.0
●0.9.0
●0.8.0
●0.7.0
●0.6.3
●0.6.2
●0.6.1
●0.6.0
●0.5.0
●0.4.1
●0.4.0
●0.3.3
●0.2.7
●Getting Started
●Guides
●API Documentation
●Source
Tree
Version 0.26.1
●entryCmp
●lookup
●lookupPrefix
●#_entryByIndex
●#_entryByName
●#builder
●#createUpdated
●#diff
●#diffWithOptions
●#dup
●#entries
●#entryById
●#entryByIndex
●#entryByName
●#entryByPath
●#entryCount
●#getEntry
●#id
●#owner
●#path
●#walk
●UPDATE
●WALK_MODE
Tree.entryCmp Sync
var result = Tree.entryCmp(e1, e2);
| Returns | |
| — | — |
| Number |
<
0 if e1 is before e2, 0 if e1 == e2, >0 if e1 is after e2 |
Tree.lookup Async
Tree.lookup(repo, id, callback).then(function(tree) {
// Use tree
});
Retrieves the tree pointed to by the oid
| Parameters |
Type |
|
| repo |
Repository |
The repo that the tree lives in |
| id |
String, Oid, Tree |
The tree to lookup |
| callback |
Function |
|
Tree.lookupPrefix Async
Tree.lookupPrefix(repo, id, len).then(function(tree) {
// Use tree
});
| Parameters |
Type |
|
| repo |
Repository |
the repo to use when locating the tree. |
| id |
Oid |
identity of the tree to locate. |
| len |
Number |
the length of the short identifier |
Tree#_entryByIndex Sync
var treeEntry = tree._entryByIndex(idx);
| Parameters |
Type |
|
| idx |
Number |
the position in the entry list |
| Returns |
|
| TreeEntry |
the tree entry; NULL if not found |
Tree#_entryByName Sync
var treeEntry = tree._entryByName(filename);
| Parameters |
Type |
|
| filename |
String |
the filename of the desired entry |
| Returns |
|
| TreeEntry |
the tree entry; NULL if not found |
Tree#builder Sync
var treebuilder = tree.builder();
Make builder. This is helpful for modifying trees.
Tree#createUpdated Async
tree.createUpdated(repo, nupdates, updates).then(function(oid) {
// Use oid
});
| Parameters |
Type |
|
| repo |
Repository |
the repository in which to create the tree, must be the same as for baseline |
| nupdates |
Number |
the number of elements in the update list |
| updates |
Array |
the list of updates to perform |
| Returns |
|
| Oid |
id of the new tree |
Tree#diff Async
tree.diff(tree, callback).then(function(diffList) {
// Use diffList
});
Diff two trees
| Parameters |
Type |
|
| tree |
Tree |
to diff against |
| callback |
Function |
|
Tree#diffWithOptions Async
tree.diffWithOptions(tree, options, callback).then(function(diffList) {
// Use diffList
});
Diff two trees with options
| Parameters |
Type |
|
| tree |
Tree |
to diff against |
| options |
Object |
|
| callback |
Function |
|
Tree#dup Async
tree.dup().then(function(tree) {
// Use tree
});
Tree#entries Sync
var arrayTreeEntry = tree.entries();
Return an array of the entries in this tree (excluding its children).
| Returns |
|
| Array<TreeEntry> |
an array of TreeEntrys |
Tree#entryById Sync
var treeEntry = tree.entryById(id);
| Parameters |
Type |
|
| id |
Oid |
the sha being looked for |
| Returns |
|
| TreeEntry |
the tree entry; NULL if not found |
Tree#entryByIndex Sync
var treeEntry = tree.entryByIndex(i);
Get an entry at the ith position.
Tree#entryByName Sync
var treeEntry = tree.entryByName(name);
Get an entry by name; if the tree is a directory, the name is the filename.
| Parameters |
Type |
|
| name |
String |
|
Tree#entryByPath Async
tree.entryByPath(path).then(function(treeEntry) {
// Use treeEntry
});
| Parameters |
Type |
|
| path |
String |
Path to the contained entry |
Tree#entryCount Sync
var result = tree.entryCount();
| Returns |
|
| Number |
the number of entries in the tree |
Tree#getEntry Async
tree.getEntry(filePath).then(function(treeEntry) {
// Use treeEntry
});
Get an entry at a path. Unlike by name, this takes a fully
qualified path, like /foo/bar/baz.javascript
| Parameters |
Type |
|
| filePath |
String |
|
Tree#idSync
var oid = tree.id();
| Returns |
|
| Oid |
object identity for the tree. |
Tree#owner Sync
var repository = tree.owner();
| Returns |
|
| Repository |
Repository that contains this tree. |
Tree#path Sync
var string = tree.path();
Return the path of this tree, like /lib/foo/bar
Tree#walk Sync
var eventEmitter = tree.walk([blobsOnly);
eventEmitter.on('entry', function(tree) {
// Use tree
});
eventEmitter.on('end', function(trees) {
// Use trees
});
eventEmitter.on('error', function(error) {
// Use error
});
Recursively walk the tree in breadth-first order. Fires an event for each
entry.
| Parameters |
Type |
|
| [blobsOnly |
Boolean |
= true] True to emit only blob & blob executable entries. |
Tree.UPDATE ENUM
| Flag |
Value |
| Tree.UPDATE.UPSERT |
0 |
| Tree.UPDATE.REMOVE |
1 |
Tree.WALK_MODE ENUM
| Flag |
Value |
| Tree.WALK_MODE.WALK_PRE |
0 |
| Tree.WALK_MODE.WALK_POST |
1 |
NodeGit, along with
this website,
is open source. It’s brought to you by a core team,
and a marvelous group of contributors.
Follow us on Twitter: @NodeGit
Licenced under MIT.