FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
nodegit/lib/blob.js at master · dawnsgithub/nodegit · GitHub
dawnsgithub
nodegit
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
nodegit
/
lib
/
blob.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
42 lines (37 loc) · 949 Bytes
Breadcrumbs
nodegit
/
lib
/
blob.js
Copy path
File metadata and controls
42 lines (37 loc) · 949 Bytes
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
30
31
32
33
34
35
36
37
38
39
40
41
42
var
NodeGit
=
require
(
"../"
)
;
var
Blob
=
NodeGit
.
Blob
;
var
LookupWrapper
=
NodeGit
.
Utils
.
lookupWrapper
;
var
TreeEntry
=
NodeGit
.
TreeEntry
;
/**
* Retrieves the blob pointed to by the oid
*
@async
*
@param
{
Repository
} repo The repo that the blob lives in
*
@param
{
String|Oid|Blob
} id The blob to lookup
*
@return
{
Blob
}
*/
Blob
.
lookup
=
LookupWrapper
(
Blob
)
;
/**
* Retrieve the content of the Blob.
*
*
@return
{
Buffer
} Contents as a buffer.
*/
Blob
.
prototype
.
content
=
function
(
)
{
return
this
.
rawcontent
(
)
.
toBuffer
(
this
.
rawsize
(
)
)
;
}
;
/**
* Retrieve the Blob's type.
*
*
@return
{
Number
} The filemode of the blob.
*/
Blob
.
prototype
.
filemode
=
function
(
)
{
var
FileMode
=
TreeEntry
.
FILEMODE
;
return
this
.
isBinary
(
)
?
FileMode
.
EXECUTABLE
:
FileMode
.
BLOB
;
}
;
/**
* Retrieve the Blob's content as String.
*
*
@return
{
String
} Contents as a string.
*/
Blob
.
prototype
.
toString
=
function
(
)
{
return
this
.
content
(
)
.
toString
(
)
;
}
;
Back
|
FazBrowse Home
|
New Git URL