@eyepop.ai/eyepop 1.12.1 → 1.12.2
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.
package/dist/eyepop.index.mjs
CHANGED
|
@@ -9532,6 +9532,15 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9532
9532
|
resolvePath = async (source) => {
|
|
9533
9533
|
throw new DOMException("resolving a path to a file is not supported in browser");
|
|
9534
9534
|
};
|
|
9535
|
+
} else if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
|
|
9536
|
+
resolvePath = async (source) => {
|
|
9537
|
+
const response = await fetch(`file://${source.path}`);
|
|
9538
|
+
const blob = await response.blob();
|
|
9539
|
+
return {
|
|
9540
|
+
stream: blob,
|
|
9541
|
+
mimeType: source.mimeType || "image/*"
|
|
9542
|
+
};
|
|
9543
|
+
};
|
|
9535
9544
|
} else {
|
|
9536
9545
|
let iteratorToStream = function(iterator) {
|
|
9537
9546
|
return new ReadableStream({
|
|
@@ -9558,7 +9567,7 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9558
9567
|
const stream = fd.createReadStream();
|
|
9559
9568
|
const iterator = nodeStreamToIterator(stream);
|
|
9560
9569
|
const webStream = iteratorToStream(iterator);
|
|
9561
|
-
const mimeType = mime.lookup(source.path) || "
|
|
9570
|
+
const mimeType = source.mimeType ? source.mimeType : mime.lookup(source.path) || "image/*";
|
|
9562
9571
|
return {
|
|
9563
9572
|
stream: webStream,
|
|
9564
9573
|
mimeType
|
|
@@ -10413,6 +10422,11 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10413
10422
|
}
|
|
10414
10423
|
}
|
|
10415
10424
|
async loadFrom(source, params) {
|
|
10425
|
+
if (source.url.startsWith("file://")) {
|
|
10426
|
+
return await this.uploadPath({
|
|
10427
|
+
path: source.url.substring("file://".length)
|
|
10428
|
+
}, params);
|
|
10429
|
+
}
|
|
10416
10430
|
if (!this._baseUrl || !this._pipelineId || !this._client || !this._limit) {
|
|
10417
10431
|
throw new Error("endpoint not connected, use connect() before loadFrom()");
|
|
10418
10432
|
}
|