Added Cloudflare Worker support (#1886).

This commit is contained in:
Richard Moore 2022-02-19 01:31:03 -05:00
parent f26074b92b
commit 2d98b4fca1

@ -49,6 +49,8 @@ export type ConnectionInfo = {
throttleSlotInterval?: number;
throttleCallback?: (attempt: number, url: string) => Promise<boolean>,
skipFetchSetup?: boolean;
timeout?: number,
};
@ -149,6 +151,10 @@ export function _fetchData<T = Uint8Array>(connection: string | ConnectionInfo,
value: "Basic " + base64Encode(toUtf8Bytes(authorization))
};
}
if (connection.skipFetchSetup != null) {
options.skipFetchSetup = !!connection.skipFetchSetup;
}
}
const reData = new RegExp("^data:([a-z0-9-]+/[a-z0-9-]+);base64,(.*)$", "i");
const dataMatch = ((url) ? url.match(reData): null);