Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@huggingface/blob
Advanced tools
Utilities to convert URLs and files to Blobs, internally used by Hugging Face libs
Utilities to convert a string or URL to a Blob object, whether it represents a local file or a remote URL.
fetch
already returns a Blob
object for remote URLs, but it loads the entire file in memory. This utility makes ad-hoc http range requests when calling .slice()
on the blob.
pnpm add @huggingface/blob
npm add @huggingface/blob
yarn add @huggingface/blob
// esm.sh
import { FileBlob } from "https://esm.sh/@huggingface/blob/FileBlob";
import { WebBlob } from "https://esm.sh/@huggingface/blob/WebBlob";
import { createBlob } from "https://esm.sh/@huggingface/blob";
// or npm:
import { FileBlob } from "npm:@huggingface/blob/FileBlob";
import { WebBlob } from "npm:@huggingface/blob/WebBlob";
import { createBlob } from "npm:@huggingface/blob";
import { FileBlob } from "@huggingface/blob/FileBlob";
import { WebBlob } from "@huggingface/blob/WebBlob";
import { createBlob } from "@huggingface/blob";
const fileBlob = await FileBlob.create("path/to/file");
const webBlob = await WebBlob.create("https://url/to/file");
const blob = await createBlob("..."); // Automatically detects if it's a file or web URL
Creates a Blob object from a string or URL. Automatically detects if it's a file or web URL.
await createBlob("...", {
/**
* Custom fetch function to use, in case it resolves to a Web Blob.
*
* Useful for adding headers, etc.
*/
fetch: ...,
});
### FileBlob
```ts
await FileBlob.create("path/to/file");
await FileBlob.create(new URL("file:///path/to/file"));
Creates a Blob object from a URL. If the file is less than 1MB (as indicated by the Content-Length header), by default it will be cached in memory in entirety upon blob creation.
This class is useful for large files that do not need to be loaded all at once in memory, as it makes range requests for the data.
await WebBlob.create("https://url/to/file");
await WebBlob.create(new URL("https://url/to/file"));
await WebBlob.create("https://url/to/file", {
/**
* Custom fetch function to use. Useful for adding headers, etc.
*/
fetch: ...,
/**
* If the file is less than the specified size, it will be cached in memory in entirety upon blob creation,
* instead of doing range requests for the data.
*
* @default 1_000_000
*/
cacheBelow: ...
})
FAQs
Utilities to convert URLs and files to Blobs, internally used by Hugging Face libs
We found that @huggingface/blob demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.