hashBlob
Compute what the SHA-1 object id of a file would be
param | type [= default] | description |
---|---|---|
core | string = 'default' | The plugin core identifier to use for plugin injection |
object | Buffer | string | The object to write. If object is a String then it will be converted to a Buffer using UTF-8 encoding. |
return | Promise<{HashBlobResult}> | Resolves successfully with the SHA-1 object id and the wrapped object Buffer. |
The object returned has the following schema:
type HashBlobResult = {
oid: string; // The SHA-1 object id
type: 'blob'; // The type of the object
object: Buffer; // The wrapped git object (the thing that is hashed)
format: 'wrapped'; // The format of the object
}
Example Code:
let { oid, type, object, format } = await git.hashBlob({
object: '$input((Hello world!))',
})
console.log('oid', oid)
console.log('type', type)
console.log('object', object)
console.log('format', format)