FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nodegit/examples/details-for-tree-entry.js at v0.9.0 · nodegit/nodegit · GitHub
nodegit
nodegit
Repository navigation
Code
Issues
344
(344)
Pull requests
23
(23)
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
nodegit
/
examples
/
details-for-tree-entry.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
29 lines (25 loc) · 1.01 KB
Breadcrumbs
nodegit
/
examples
/
details-for-tree-entry.js
Copy path
File metadata and controls
29 lines (25 loc) · 1.01 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
var
nodegit
=
require
(
"../"
)
;
var
path
=
require
(
"path"
)
;
/**
* This shows how to get details from a tree entry or a blob
**/
nodegit
.
Repository
.
open
(
path
.
resolve
(
__dirname
,
"../.git"
)
)
.
then
(
function
(
repo
)
{
return
repo
.
getTree
(
"e1b0c7ea57bfc5e30ec279402a98168a27838ac9"
)
.
then
(
function
(
tree
)
{
var
treeEntry
=
tree
.
entryByIndex
(
0
)
;
// Tree entry doesn't have any data associated with the actual entry
// To get that we need to get the index entry that this points to
return
repo
.
openIndex
(
)
.
then
(
function
(
index
)
{
var
indexEntry
=
index
.
getByPath
(
treeEntry
.
path
(
)
)
;
// With the index entry we can now view the details for the tree entry
console
.
log
(
"Entry path: "
+
indexEntry
.
path
(
)
)
;
console
.
log
(
"Entry time in seconds: "
+
indexEntry
.
mtime
(
)
.
seconds
(
)
)
;
console
.
log
(
"Entry oid: "
+
indexEntry
.
id
(
)
.
toString
(
)
)
;
console
.
log
(
"Entry size: "
+
indexEntry
.
fileSize
(
)
)
;
}
)
;
}
)
;
}
)
.
done
(
function
(
)
{
console
.
log
(
"Done!"
)
;
}
)
;
Back
|
FazBrowse Home
|
New Git URL