layout
default
menu_item
api
title
Blob
description
Version 0.26.1
return_to
API Documentation Index
/api/
sections
createFromBuffer
createFromDisk
createFromWorkdir
filteredContent
lookup
lookupPrefix
#content
#dup
#filemode
#filter
#id
#isBinary
#owner
#rawcontent
#rawsize
#toString
FILTER_FLAG
#createFromBuffer
#createFromDisk
#createFromWorkdir
#filteredContent
#lookup
#lookupPrefix
#content
#dup
#filemode
#filter
#id
#isBinary
#owner
#rawcontent
#rawsize
#toString
#FILTER_FLAG
Blob. createFromBuffer Async
Blob . createFromBuffer ( repo , buffer , len ) . then ( function ( oid ) {
// Use oid
} ) ;
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
Blob. createFromDisk Async
Blob . createFromDisk ( repo , path ) . then ( function ( oid ) {
// Use oid
} ) ;
Parameters
Type
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
Oid
return the id of the written blob
Blob. createFromWorkdir Async
Blob . createFromWorkdir ( repo , relative_path ) . then ( function ( oid ) {
// Use oid
} ) ;
Parameters
Type
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
Oid
return the id of the written blob
Blob. filteredContent Async
Blob . filteredContent ( blob , as_path , check_for_binary_data ) . then ( function ( buffer ) {
// Use buffer
} ) ;
Parameters
Type
blob
Blob
as_path
String
check_for_binary_data
Number
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.
blob . dup ( ) . then ( function ( blob ) {
// Use blob
} ) ;
var number = blob . filemode ( ) ;
Retrieve the Blob's type.
Returns
Number
The filemode of the blob.
blob . filter ( asPath , opts ) . then ( function ( promiseString ) {
// Use promiseString
} ) ;
Get a buffer with the filtered content of a blob.
This applies filters as if the blob was being checked out to the
working directory under the specified filename. This may apply
CRLF filtering or other types of changes depending on the file
attributes set for the blob and the content detected in it.
| Parameters | Type |
| --- | --- | --- |
| asPath | | Path used for file attribute lookups, etc. |
| opts | | Options to use for filtering 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.
| Flag | Value |
| --- | --- | --- |
| Blob.FILTER_FLAG. CHECK_FOR_BINARY | 1 |
| Blob.FILTER_FLAG. NO_SYSTEM_ATTRIBUTES | 2 |
| Blob.FILTER_FLAG. ATTTRIBUTES_FROM_HEAD | 4 |