MCPcopy Create free account
hub / github.com/ScattrdBlade/bigFileUpload / uploadToFilebin

Function uploadToFilebin

utils/upload.ts:872–894  ·  view source on GitHub ↗
(fileBlob: Blob, filename: string)

Source from the content-addressed store, hash-verified

870}
871
872async function uploadToFilebin(fileBlob: Blob, filename: string): Promise<string> {
873 if (Native) {
874 const result = await Native.uploadToFilebin(await fileBlob.arrayBuffer(), filename);
875 if (!result.success || !result.url) throw new Error(result.error || "No URL returned from upload");
876 return result.url;
877 }
878
879 const binId = makeRandomHex(6);
880 const uploadUrl = `https://filebin.net/${binId}/${encodeURIComponent(filename)}`;
881 const formData = new FormData();
882 formData.append("file", fileBlob, filename);
883
884 const response = await uploadRequestWithTimeout(uploadUrl, {
885 method: "POST",
886 body: formData
887 });
888
889 if (!response.ok) {
890 throw new Error(`Upload failed: ${response.status} ${await response.text()}`);
891 }
892
893 return `https://filebin.net/${binId}/${encodeURIComponent(filename)}`;
894}
895
896async function uploadToPixelVault(fileBlob: Blob, filename: string): Promise<string> {
897 const { pixelVaultKey } = settings.store as { pixelVaultKey?: string; };

Callers 1

uploadToServiceFunction · 0.70

Calls 3

uploadRequestWithTimeoutFunction · 0.85
textMethod · 0.80
makeRandomHexFunction · 0.70

Tested by

no test coverage detected