Product
Socket Now Supports uv.lock Files
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
@samvera/image-downloader
Advanced tools
React component and JavaScript modules to help force an image download in the browser
JavaScript modules and a convenience React component which will force a jpeg download of an image URL. Built for the use case of needing to offer JPG downloads for images hosted via a IIIF image server.
Install the package:
npm install @samvera/image-downloader
Import JavaScript modules into your project to use directly:
import { makeBlob, mimicDownload } from "@samvera/image-downloader";
var url =
"https://iiif.stack.rdc.library.northwestern.edu/iiif/2/8f7bf326-e71d-4b6f-abb8-f6a40f412883/full/3000,/0/default.jpg";
// HTML or JSX file
<button
onClick={async () => {
let response = await makeBlob(url);
// Handle any errors
if (!response || response.error) {
// Customize this for your app
alert("Error fetching the image");
return;
}
mimicDownload(response, "your-jpg-title");
}}
>
Download me
</button>;
The makeBlob()
function utilizes fetch() for requests. You can chose to customize the options
object.
makeBlob(url, { credentials: "include" });
If importing into a React project, you can import the component directly:
import { ImageDownloader } from "@samvera/image-downloader";
<ImageDownloader
imageUrl={`https://your-image-url`}
imageTitle={`Beautiful image`}
>
Download JPEG
</ImageDownloader>;
For complete props
and usage examples, view the docs
You can customize the look and feel of the button. View the docs
This project is licensed under the MIT License - see the LICENSE.md file for details
FAQs
React component and JavaScript modules to help force an image download in the browser
We found that @samvera/image-downloader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.