UNPKG

1.64 kBTypeScriptView Raw
1import { WriteStream } from "fs";
2import { Oid } from "./oid";
3import { Repository } from "./repository";
4import { Wrapper } from "./wrapper";
5
6export class Blob {
7 /**
8 * @param repo - repository where to blob will be written
9 * @param buffer - data to be written into the blob
10 * @param len - length of the data
11 * @returns - return the id of the written blob
12 */
13 static createFromBuffer(repo: Repository, buffer: Buffer, len: number): Promise<Oid>;
14 /**
15 * @param repo - repository where the blob will be written. this repository can be bare or not
16 * @param path - file from which the blob will be created
17 */
18 static createFromDisk(repo: Repository, path: string): Promise<Oid>;
19 static createFromStream(repo: Repository, hintPath: string): Promise<WriteStream>;
20 /**
21 * @param repo - repository where the blob will be written. this repository cannot be bare
22 * @param relativePath - file from which the blob will be created, relative to the repository's working dir
23 * @returns - 0 or an error code
24 */
25 static createFromWorkdir(repo: Repository, relativePath: string): Promise<Oid>;
26 static filteredContent(blob: Blob, as_path: string, check_for_binary_data: number): Promise<Buffer>;
27 static lookup(repo: Repository, id: string | Oid | Blob): Promise<Blob>;
28 static lookupPrefix(repo: Repository, id: Oid, len: number): Promise<Blob>;
29
30 id(): Oid;
31 isBinary(): number;
32 owner(): Repository;
33 rawcontent(): Wrapper;
34 rawsize(): number;
35 content(): Buffer;
36 toString(): string;
37 filemode(): number;
38 dup(): Promise<Blob>;
39}