Use nulls, make-sql

This commit is contained in:
Min Idzelis
2025-05-03 02:06:34 +00:00
parent 0ed2a2fd2e
commit aea2c9506d
19 changed files with 186 additions and 205 deletions

View File

@@ -24,7 +24,10 @@ export function asHumanReadable(bytes: number, precision = 1): string {
}
// if an asset is jsonified in the DB before being returned, its buffer fields will be hex-encoded strings
export const hexOrBufferToBase64 = (encoded: string | Buffer) => {
export const hexOrBufferToBase64 = (encoded: string | Buffer | null) => {
if (!encoded) {
return null;
}
if (typeof encoded === 'string') {
return Buffer.from(encoded.slice(2), 'hex').toString('base64');
}