DefinitelyTyped/types/nodegit/blob.d.ts
Benjamin Schuster-Boeckler 158b37a44f Fixed incorrect types in nodegit class DiffDelta and Blob (#41314)
* Fixes incorrect return types in diff-delta and blob. Should be functions, not direct accessor properties. Also, `rawcontent` returns a wrapper around a Buffer, not a Buffer directly, as `content` does.

* updated package description and version

* fixed missing argument

* Updates jackrabbit types to export namespace for interface and type access. Adds missing options and arguments to a few methods.

* fixed linting issue

* revert changes to jackrabbit
2020-01-02 15:11:55 -08:00

41 lines
1.6 KiB
TypeScript

import { WriteStream } from 'fs';
import { Wrapper } from "./wrapper";
import { Repository } from './repository';
import { Oid } from './oid';
export class Blob {
/**
* @param repo - repository where to blob will be written
* @param buffer - data to be written into the blob
* @param len - length of the data
* @returns - return the id of the written blob
*/
static createFromBuffer(repo: Repository, buffer: Buffer, len: number): Promise<Oid>;
/**
* @param repo - repository where the blob will be written. this repository can be bare or not
* @param path - file from which the blob will be created
*/
static createFromDisk(repo: Repository, path: string): Promise<Oid>;
static createFromStream(repo: Repository, hintPath: string): Promise<WriteStream>;
/**
* @param repo - repository where the blob will be written. this repository cannot be bare
* @param relativePath - file from which the blob will be created, relative to the repository's working dir
* @returns - 0 or an error code
*/
static createFromWorkdir(repo: Repository, relativePath: string): Promise<Oid>;
static filteredContent(blob: Blob, as_path: string, check_for_binary_data: number): Promise<Buffer>;
static lookup(repo: Repository, id: string | Oid | Blob): Promise<Blob>;
static lookupPrefix(repo: Repository, id: Oid, len: number): Promise<Blob>;
free(): void;
id(): Oid;
isBinary(): number;
owner(): Repository;
rawcontent(): Wrapper;
rawsize(): number;
content(): Buffer;
toString(): string;
filemode(): number;
dup(): Promise<Blob>;
}