diff options
Diffstat (limited to 'packages/server/src/git/blob.ts')
-rw-r--r-- | packages/server/src/git/blob.ts | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/packages/server/src/git/blob.ts b/packages/server/src/git/blob.ts new file mode 100644 index 0000000..aa3f9ad --- /dev/null +++ b/packages/server/src/git/blob.ts @@ -0,0 +1,13 @@ +import { TreeEntry as NodeGitTreeEntry } from "nodegit"; + +export class Blob { + private _ng_tree_entry: NodeGitTreeEntry; + + constructor(entry: NodeGitTreeEntry) { + this._ng_tree_entry = entry; + } + + async content(): Promise<string> { + return this._ng_tree_entry.isBlob() ? (await this._ng_tree_entry.getBlob()).toString() : ""; + } +}
\ No newline at end of file |