Odb.hashfile Async

Odb.hashfile(path, type).then(function(oid) {
  // Use oid
});
Parameters Type  
path String file to read and determine object id for
type Number the type of the object that will be hashed
Returns  
Oid oid structure the result is written into.

Odb.open Async

Odb.open(objects_dir).then(function(odb) {
  // Use odb
});
Parameters Type  
objects_dir String path of the backends’ “objects” directory.
Returns  
Odb  

Odb#addDiskAlternate Async

odb.addDiskAlternate(path).then(function(result) {
  // Use result
});
Parameters Type  
path String path to the objects folder for the alternate
Returns  
Number 0 on success; error code otherwise

Odb#existsPrefix Async

odb.existsPrefix(short_id, len).then(function(oid) {
  // Use oid
});
Parameters Type  
short_id Oid A prefix of the id of the object to read.
len Number The length of the prefix.
Returns  
Oid The full OID of the found object if just one is found.

Odb#read Async

odb.read(id).then(function(odbObject) {
  // Use odbObject
});
Parameters Type  
id Oid identity of the object to read.
Returns  
OdbObject the read object

Odb#readPrefix Async

odb.readPrefix(short_id, len).then(function(odbObject) {
  // Use odbObject
});
Parameters Type  
short_id Oid a prefix of the id of the object to read.
len Number the length of the prefix
Returns  
OdbObject the read object

Odb#write Async

odb.write(data, len, type).then(function(oid) {
  // Use oid
});
Parameters Type  
data Buffer buffer with the data to store
len Number size of the buffer
type Number type of the data to store
Returns  
Oid  

Odb.STREAM ENUM

Flag Value
Odb.STREAM.RDONLY 2
Odb.STREAM.WRONLY 4
Odb.STREAM.RW 6