import type { ObjectItem } from './object-list'; import Ref from './ref'; import type Repository from './repository'; export default class BitObject { validateBeforePersist: boolean; id(): string | Buffer; toBuffer(pretty?: boolean): Buffer; refs(): Ref[]; getType(): string; getHeader(buffer: Buffer): string; collectRefs(repo: Repository): Promise; collectRaw(repo: Repository): Promise; asRaw(repo: Repository): Promise; collect(repo: Repository): BitObject[]; /** * indexing method */ hash(): Ref; compress(): Promise; serialize(): Buffer; /** * see `this.parseSync` for the sync version */ static parseObject(fileContents: Buffer, filePath?: string): Promise; /** * same as `parseObject`, however, if the type is not one of the given "typeNames", it returns null. * the performance improvement is huge compare to "parseObject", as it doesn't parse the object if not needed. */ static parseObjectOnlyIfType(fileContents: Buffer, typeNames: string[], filePath?: string): Promise; /** * prefer using `this.parseObject()`, unless it must be sync. */ static parseSync(fileContents: Buffer): BitObject; static makeHash(str: string | Buffer): string; }