Skip to content
This repository was archived by the owner on Mar 28, 2025. It is now read-only.

Commit b1e3632

Browse files
authored
set content url to remote storage url if http (#15)
1 parent 1fef6d4 commit b1e3632

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "getindexify",
3-
"version": "0.0.21",
3+
"version": "0.0.22",
44
"description": "This is the TypeScript client for interacting with the Indexify service.",
55
"main": "./dist/index.js",
66
"module": "./dist/index.mjs",

src/client.ts

+12-2
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,23 @@ class IndexifyClient {
8787
throw error;
8888
}
8989
}
90-
90+
9191
private baseContentToContentMetadata = (
9292
content: IBaseContentMetadata
9393
): IContentMetadata => {
94+
let content_url: string;
95+
96+
if (content.storage_url.startsWith("http")) {
97+
// if content is ingested with remote url use storage url
98+
content_url = content.storage_url;
99+
} else {
100+
// use streaming api for content url
101+
content_url = `${this.serviceUrl}/namespaces/${this.namespace}/content/${content.id}/download`;
102+
}
103+
94104
return {
95105
...content,
96-
content_url: `${this.serviceUrl}/namespaces/${this.namespace}/content/${content.id}/download`,
106+
content_url,
97107
};
98108
};
99109

0 commit comments

Comments
 (0)