npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@universalappfactory/tauri-plugin-medialibrary

v0.11.0

Published

A tauri plugin to access the systems media library (e.g. the android medialibrary)

Readme

Tauri Media Library Plugin

| Platform | Supported | | -------- | --------- | | Linux | ✓ | | Windows | ✓ | | macOS | x | | Android | ✓ | | iOS | x |

This plugin is aimed to give you easy access to the system's "media library". It returns a list of image metadata such as path, uri (e.g. the content uri on android) and mime type.

It has also functions to get a thumbnail for a image.

Android

On android the plugin reads the content of the android media store.

Linux

On Linux it reads pictures from the XDG_PICTURE directory.

Windows

On windows it uses the:

https://tauri.app/reference/javascript/api/namespacepath/#picturedir

Thumbnails

Thumbnails can be read using the https://crates.io/crates/thumbcache crate. When using thumbcache, you have to use the thumb_cache feature

cargo build --features thumb_cache

IOs

Not implemented yet

Install

Install the Core plugin by adding the following to your Cargo.toml file:

src-tauri/Cargo.toml

[dependencies]
# cargo crate is not ready yet
# tauri-plugin-medialibrary = "0.2.1"
# alternatively with Git:
tauri-plugin-medialibrary = { git = "https://github.com/universalappfactory/tauri-plugin-medialibrary" }

You can install the JavaScript Guest bindings using your preferred JavaScript package manager:

pnpm add @universalappfactory/tauri-plugin-medialibrary
# or
npm add @universalappfactory/tauri-plugin-medialibrary
# or
yarn add @universalappfactory/tauri-plugin-medialibrary

# alternatively with Git:
pnpm add https://github.com/universalappfactory/tauri-plugin-medialibrary
# or
npm add https://github.com/universalappfactory/tauri-plugin-medialibrary
# or
yarn add https://github.com/universalappfactory/tauri-plugin-medialibrary

Usage

First you need to register the core plugin with Tauri:

src-tauri/src/lib.rs

fn main() {
    tauri::Builder::default()
        .plugin(tauri_plugin_medialibrary::init())
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

Next you have to configure the permissions:

You must configure, which image sources are allowed, e.g you can add a

src-tauri/capabilities/default.json

{
  "$schema": "../gen/schemas/desktop-schema.json",
  "identifier": "default",
  "description": "Capability for the main window",
  "windows": ["main"],
  "permissions": [
    {
      "identifier": "medialibrary:global-scope",
      "allow": [
        {
          "source": "PictureDir"
        }
      ]
    },
    "medialibrary:allow-get-images",
    "medialibrary:allow-get-image",
    "medialibrary:allow-get-thumbnail",
    "medialibrary:allow-get-available-sources",
    "medialibrary:allow-request-permissions",
  ]
}

and

src-tauri/capabilities/default.android.json

{
  "$schema": "../gen/schemas/desktop-schema.json",
  "identifier": "default",
  "description": "Capability for the main window",
  "windows": ["main"],
  "permissions": [
    {
      "identifier": "medialibrary:global-scope",
      "allow": [
        {
          "source": "ExternalStorage"
        },
        {
          "source": "VolumeExternalPrimary"
        }
      ]
    },
    "medialibrary:allow-get-images",
    "medialibrary:allow-get-image",
    "medialibrary:allow-get-thumbnail",
    "medialibrary:allow-get-available-sources",
    "medialibrary:allow-request-permissions",
  ]
}

Depending on the platform, you have the following options at the moment:

Android

  • ExternalStorage
  • VolumeExternalPrimary

Linux

  • PictureDir

Afterwards all the plugin's APIs are available through the JavaScript guest bindings:

import {
  getAvailableSources,
  getImages,
  GetLibraryContentRequest,
  ImageInfo,
  MediaLibrarySource,
  PermissionResponse,
  PluginError,
  requestPermissions,
  getImage,
} from "@universalappfactory/tauri-plugin-medialibrary";

// request permissions (needed for accessing the android media library)
const permissions = await requestPermissions();
if (permissions && permissions.postNotification === "denied") {
  throw new Error("Permission denied");
}

const request: GetLibraryContentRequest = {
  limit: 10,
  offset: 0,
  source: MediaLibrarySource.ExternalStorage,
};

const result = await getImages(request);

Open an image with the default application

You can use the opener plugin to open an image with the default application:

https://github.com/tauri-apps/plugins-workspace/tree/v2/plugins/opener

It is also able to open android content uris.

Reading an image

For reading images, you can use the tauri fs plugin:

https://github.com/tauri-apps/plugins-workspace/tree/v2/plugins/fs

E.g. in rust

let mut options = OpenOptions::new();
options.read(true);

#[cfg(target_os = "android")]
match self.app_handle.fs().open(path, options) {
    Ok(file) => {
      ...
    }
}

Example Application

An example application is available here.