Skip to content

Latest commit

 

History

History
251 lines (189 loc) · 6.42 KB

File metadata and controls

251 lines (189 loc) · 6.42 KB
layout default
menu_item api
title Blob
description Version 0.19.0
return_to
API Documentation Index
/api/
sections
createFromBuffer createFromDisk createFromStream createFromWorkdir createFromstreamCommit lookup lookupPrefix #content #dup #filemode #free #id #isBinary #owner #rawcontent #rawsize #toString
#createFromBuffer
#createFromDisk
#createFromStream
#createFromWorkdir
#createFromstreamCommit
#lookup
#lookupPrefix
#content
#dup
#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

Blob.createFromDisk Sync

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.createFromStream Async

Blob.createFromStream(repo, hintpath).then(function(writestream) {
  // Use writestream
});
Parameters Type
repo Repository Repository where the blob will be written. This repository can be bare or not.
hintpath String If not NULL, will be used to select data filters to apply onto the content of the blob to be created.
Returns
Writestream the stream into which to write

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.createFromstreamCommit Async

Blob.createFromstreamCommit(stream).then(function(oid) {
  // Use oid
});
Parameters Type
stream Writestream the stream to close
Returns
Oid the id of the new blob

Blob.lookup Async

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
Returns
Blob

Blob.lookupPrefix Async

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
Returns
Blob

Blob#content Sync

var buffer = blob.content();

Retrieve the content of the Blob.

Returns
Buffer Contents as a buffer.

Blob#dup Async

blob.dup().then(function(blob) {
  // Use blob
});
Returns
Blob

Blob#filemode Sync

var number = blob.filemode();

Retrieve the Blob's type.

Returns
Number The filemode of the blob.

Blob#free Sync

blob.free();

Blob#id Sync

var oid = blob.id();
Returns
Oid SHA1 hash for this blob.

Blob#isBinary Sync

var result = blob.isBinary();
Returns
Number 1 if the content of the blob is detected
as binary; 0 otherwise.

Blob#owner Sync

var repository = blob.owner();
Returns
Repository Repository that contains this blob.

Blob#rawcontent Sync

var buffer = blob.rawcontent();
Returns
Buffer

Blob#rawsize Sync

var result = blob.rawsize();
Returns
Number size on bytes

Blob#toString Sync

var string = blob.toString();

Retrieve the Blob's content as String.

Returns
String Contents as a string.