From a13786d6cc185822f5940582efde2349ef729145 Mon Sep 17 00:00:00 2001 From: HampusM Date: Thu, 24 Jun 2021 22:50:38 +0200 Subject: Refactored the backend yet again --- packages/server/src/git/blob.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 packages/server/src/git/blob.ts (limited to 'packages/server/src/git/blob.ts') 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 { + return this._ng_tree_entry.isBlob() ? (await this._ng_tree_entry.getBlob()).toString() : ""; + } +} \ No newline at end of file -- cgit v1.2.3-18-g5258