@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.d.mts
CHANGED
package/dist/eyepop.index.d.ts
CHANGED
package/dist/eyepop.index.js
CHANGED
|
@@ -9594,6 +9594,15 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9594
9594
|
resolvePath = async (source) => {
|
|
9595
9595
|
throw new DOMException("resolving a path to a file is not supported in browser");
|
|
9596
9596
|
};
|
|
9597
|
+
} else if (typeof navigator !== "undefined" && navigator.product === "ReactNative") {
|
|
9598
|
+
resolvePath = async (source) => {
|
|
9599
|
+
const response = await fetch(`file://${source.path}`);
|
|
9600
|
+
const blob = await response.blob();
|
|
9601
|
+
return {
|
|
9602
|
+
stream: blob,
|
|
9603
|
+
mimeType: source.mimeType || "image/*"
|
|
9604
|
+
};
|
|
9605
|
+
};
|
|
9597
9606
|
} else {
|
|
9598
9607
|
let iteratorToStream = function(iterator) {
|
|
9599
9608
|
return new ReadableStream({
|
|
@@ -9620,7 +9629,7 @@ if ("document" in globalThis && "implementation" in globalThis.document) {
|
|
|
9620
9629
|
const stream = fd.createReadStream();
|
|
9621
9630
|
const iterator = nodeStreamToIterator(stream);
|
|
9622
9631
|
const webStream = iteratorToStream(iterator);
|
|
9623
|
-
const mimeType = mime.lookup(source.path) || "
|
|
9632
|
+
const mimeType = source.mimeType ? source.mimeType : mime.lookup(source.path) || "image/*";
|
|
9624
9633
|
return {
|
|
9625
9634
|
stream: webStream,
|
|
9626
9635
|
mimeType
|
|
@@ -10475,6 +10484,11 @@ var WorkerEndpoint = class extends Endpoint {
|
|
|
10475
10484
|
}
|
|
10476
10485
|
}
|
|
10477
10486
|
async loadFrom(source, params) {
|
|
10487
|
+
if (source.url.startsWith("file://")) {
|
|
10488
|
+
return await this.uploadPath({
|
|
10489
|
+
path: source.url.substring("file://".length)
|
|
10490
|
+
}, params);
|
|
10491
|
+
}
|
|
10478
10492
|
if (!this._baseUrl || !this._pipelineId || !this._client || !this._limit) {
|
|
10479
10493
|
throw new Error("endpoint not connected, use connect() before loadFrom()");
|
|
10480
10494
|
}
|