aboutsummaryrefslogtreecommitdiff
path: root/packages/server/src/git/blob.ts
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2021-06-24 22:50:38 +0200
committerHampusM <hampus@hampusmat.com>2021-06-24 22:50:38 +0200
commita13786d6cc185822f5940582efde2349ef729145 (patch)
tree7d4f49b50fc30ced65c5661b22b027456b79948e /packages/server/src/git/blob.ts
parent01e5d215dbc152e34ecd005111171457f87c235d (diff)
Refactored the backend yet again
Diffstat (limited to 'packages/server/src/git/blob.ts')
-rw-r--r--packages/server/src/git/blob.ts13
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