Socket
Socket
Sign inDemoInstall

@gradio/utils

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@gradio/utils - npm Package Compare versions

Comparing version 0.5.0 to 0.5.1

6

CHANGELOG.md
# @gradio/utils
## 0.5.1
### Fixes
- [#8737](https://github.com/gradio-app/gradio/pull/8737) [`31a876d`](https://github.com/gradio-app/gradio/commit/31a876d0274d7b74a90d30148f3e9c098f486242) - Fix `Share to community` button for images. Thanks @hannahblair!
## 0.5.0

@@ -4,0 +10,0 @@

2

package.json
{
"name": "@gradio/utils",
"version": "0.5.0",
"version": "0.5.1",
"description": "Gradio UI packages",

@@ -5,0 +5,0 @@ "type": "module",

@@ -34,3 +34,3 @@ import type { ActionReturn } from "svelte/action";

export async function uploadToHuggingFace(
data: string,
data: string | { url?: string; path?: string },
type: "base64" | "url"

@@ -45,3 +45,13 @@ ): Promise<string> {

if (type === "url") {
const response = await fetch(data);
let url: string;
if (typeof data === "object" && data.url) {
url = data.url;
} else if (typeof data === "string") {
url = data;
} else {
throw new Error("Invalid data format for URL type");
}
const response = await fetch(url);
blob = await response.blob();

@@ -51,5 +61,15 @@ contentType = response.headers.get("content-type") || "";

} else {
blob = dataURLtoBlob(data);
contentType = data.split(";")[0].split(":")[1];
filename = "file" + contentType.split("/")[1];
let dataurl: string;
if (typeof data === "object" && data.path) {
dataurl = data.path;
} else if (typeof data === "string") {
dataurl = data;
} else {
throw new Error("Invalid data format for base64 type");
}
blob = dataURLtoBlob(dataurl);
contentType = dataurl.split(";")[0].split(":")[1];
filename = "file." + contentType.split("/")[1];
}

@@ -56,0 +76,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc