applesauce-core 0.0.0-next-20250123215242 → 0.0.0-next-20250124151214
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -51,3 +51,5 @@ export declare function getMediaAttachments(event: NostrEvent): FileMetadata[];
|
|
|
51
51
|
* @throws
|
|
52
52
|
*/
|
|
53
53
|
export declare function getFileMetadata(file: NostrEvent): FileMetadata;
|
|
54
|
+
/** Returns the last 64 length hex string in a URL */
|
|
55
|
+
export declare function getSha256FromURL(url: string | URL): string | null;
|
|
@@ -88,3 +88,12 @@ export function getMediaAttachments(event) {
|
|
|
88
88
|
export function getFileMetadata(file) {
|
|
89
89
|
return parseFileMetadataTags(file.tags);
|
|
90
90
|
}
|
|
91
|
+
/** Returns the last 64 length hex string in a URL */
|
|
92
|
+
export function getSha256FromURL(url) {
|
|
93
|
+
if (typeof url === "string")
|
|
94
|
+
url = new URL(url);
|
|
95
|
+
const hashes = Array.from(url.pathname.matchAll(/[0-9a-f]{64}/gi));
|
|
96
|
+
if (hashes.length > 0)
|
|
97
|
+
return hashes[hashes.length - 1][0];
|
|
98
|
+
return null;
|
|
99
|
+
}
|