layout
default
menu_item
api
title
Blob
description
Version 0.10.0
return_to
API Documentation Index
/api/
sections
createFromBuffer
createFromDisk
createFromWorkdir
lookup
lookupPrefix
#content
#filemode
#free
#id
#isBinary
#owner
#rawcontent
#rawsize
#toString
#createFromBuffer
#createFromDisk
#createFromWorkdir
#lookup
#lookupPrefix
#content
#filemode
#free
#id
#isBinary
#owner
#rawcontent
#rawsize
#toString
Blob. createFromBuffer Sync
var oid = Blob . createFromBuffer ( repo , buffer , len ) ;
Parameters
Type
repo
Repository
repository where to blob will be written
buffer
Buffer
data to be written into the blob
len
Number
length of the data
Returns
Oid
return the id of the written blob
var result = Blob . createFromDisk ( id , repo , path ) ;
Parameters
Type
id
Oid
return the id of the written blob
repo
Repository
repository where the blob will be written. this repository can be bare or not
path
String
file from which the blob will be created
Returns
Number
0 or an error code
Blob. createFromWorkdir Sync
var result = Blob . createFromWorkdir ( id , repo , relative_path ) ;
Parameters
Type
id
Oid
return the id of the written blob
repo
Repository
repository where the blob will be written. this repository cannot be bare
relative_path
String
file from which the blob will be created, relative to the repository's working dir
Returns
Number
0 or an error code
Blob . lookup ( repo , id ) . then ( function ( blob ) {
// Use blob
} ) ;
Retrieves the blob pointed to by the oid
Parameters
Type
repo
Repository
The repo that the blob lives in
id
String, Oid , Blob
The blob to lookup
Blob . lookupPrefix ( repo , id , len ) . then ( function ( blob ) {
// Use blob
} ) ;
Parameters
Type
repo
Repository
the repo to use when locating the blob.
id
Oid
identity of the blob to locate.
len
Number
the length of the short identifier
var buffer = blob . content ( ) ;
Retrieve the content of the Blob.
Returns
Buffer
Contents as a buffer.
var number = blob . filemode ( ) ;
Retrieve the Blob's type.
Returns
Number
The filemode of the blob.
Returns
Oid
SHA1 hash for this blob.
var result = blob . isBinary ( ) ;
Returns
Number
1 if the content of the blob is detected
as binary; 0 otherwise.
var repository = blob . owner ( ) ;
Returns
Repository
Repository that contains this blob.
var buffer = blob . rawcontent ( ) ;
var result = blob . rawsize ( ) ;
Returns
Number
size on bytes
var string = blob . toString ( ) ;
Retrieve the Blob's content as String.
Returns
String
Contents as a string.