Skip to content

Commit 349e9c0

Browse files
committed
feat: add sizeBytes field
1 parent 94f018b commit 349e9c0

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/storage/storage.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export type PasteMetadata = {
99
willExpireAtUnix: number
1010

1111
accessCounter: number // a counter representing how frequent it is accessed, to administration usage
12+
sizeBytes?: number,
1213
filename?: string
1314
}
1415

@@ -100,6 +101,7 @@ export async function updatePaste(
100101
createdAtUnix: originalMetadata.createdAtUnix,
101102
willExpireAtUnix: expirationUnix,
102103
accessCounter: originalMetadata.accessCounter,
104+
sizeBytes: content.byteLength,
103105
},
104106
expiration: expirationUnix,
105107
}
@@ -129,6 +131,7 @@ export async function createPaste(
129131
createdAtUnix: dateToUnix(options.now),
130132
willExpireAtUnix: expirationUnix,
131133
accessCounter: 0,
134+
sizeBytes: content.byteLength,
132135
},
133136
expiration: expirationUnix,
134137
}

0 commit comments

Comments
 (0)