tauri-remote-caching-plugin

A Tauri plugins that caches remote files

https://github.com/altaks/tauri-remote-caching-plugin

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.8%) to scientific vocabulary

Keywords

cache cache-control caching file files remote tauri tauri-plugin
Last synced: 6 months ago · JSON representation ·

Repository

A Tauri plugins that caches remote files

Basic Info
  • Host: GitHub
  • Owner: Altaks
  • License: mit
  • Language: Rust
  • Default Branch: master
  • Homepage:
  • Size: 239 KB
Statistics
  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • Open Issues: 1
  • Releases: 0
Topics
cache cache-control caching file files remote tauri tauri-plugin
Created over 1 year ago · Last pushed over 1 year ago
Metadata Files
Readme License Citation Codeowners

README.md

Tauri Plugin | Remote caching

Caches remote files in the user's application folder for a better bandwidth management.

Installation

This plugin requires a Rust version of at least 1.60

There are three general methods of installation that we can recommend.

  • Use crates.io and npm (easiest, and requires you to trust that our publishing pipeline worked)
  • Pull sources directly from Github using git tags / revision hashes (most secure)
  • Git submodule install this repo in your tauri project and then use file protocol to ingest the source (most secure, but inconvenient to use)

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

toml [dependencies] tauri-plugin-remote-caching = { git = "https://github.com/Altaks/Tauri-Remote-Caching-Plugin/"}

You can install the JavaScript/TypeScript guest bindings using your preferred JavaScript package manager :

Note: If your JavaScript package manager cannot install packages from git monorepos, you can still use the code by manually copying the Guest bindings into your source files

```sh pnpm add https://github.com/Altaks/Tauri-Remote-Caching-Plugin

or

npm add https://github.com/Altaks/Tauri-Remote-Caching-Plugin

or

yarn add https://github.com/Altaks/Tauri-Remote-Caching-Plugin ```

Usage

First of all you need to register the plugin in the Rust part of you application :

src-tauri/src/main.rs :

rust fn main() { tauri::Builder::default() .plugin(tauri_plugin_remote_caching::init()) .invoke_handler(tauri::generate_handler![greet]) .run(tauri::generate_context!()) .expect("error while running tauri application"); }

Afterward the whole plugin's API is available through the JavaScript Guest bindings :

Warning : You must add the following inside your application config (tauri.conf.json) inside the tauri configuration part :

json "protocol": { "asset": true, "assetScope": ["**"] } Furthermore, you must enable these features on your app's tauri dependency :

toml tauri = { version = "1", features = [ "protocol-asset", "fs-all", "shell-open", "path-all"] }

```tsx export const CachedImage = ({src, className}: {src: string, className?: string}) => {

// We set a default state of no-url to display nothing
const [url, setUrl] = useState("");

// Loads the requested image
const loadImage = async () => {
    console.log(`Searching cached image`)
    const cachedImage = await cached(src)
    console.log(`Found cached image : ${cachedImage}`)
    setUrl(convertFileSrc(cachedImage));
}

// Start the image caching / retrieving
useEffect(() => {
    loadImage().catch(console.error)
}, [src]);

return (
    <>
        <img src={url} alt={url} className={className} decoding={"async"}/>
    </>
)

} ```

Contributing

PR accepted. I might take time to make PR's reviews, feel free to contact me altair61.dev@gmail.com.

Owner

  • Name: Altaks
  • Login: Altaks
  • Kind: user
  • Location: France

I'm currently 18yo, french student.

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
  - name: Altaks
    orcid: https://orcid.org/0009-0001-6791-4435
title: "Tauri Remote Caching Plugin"
version: 1.0.0
date-released: 2024-09-12
url: https://github.com/tauri-apps/Tauri-Remote-Caching-Plugin

GitHub Events

Total
  • Watch event: 1
Last Year
  • Watch event: 1

Committers

Last synced: over 1 year ago

All Time
  • Total Commits: 11
  • Total Committers: 2
  • Avg Commits per committer: 5.5
  • Development Distribution Score (DDS): 0.455
Past Year
  • Commits: 11
  • Committers: 2
  • Avg Commits per committer: 5.5
  • Development Distribution Score (DDS): 0.455
Top Committers
Name Email Commits
Arnaud Mazurier 5****s 6
Altaks a****v@g****m 5

Issues and Pull Requests

Last synced: over 1 year ago

All Time
  • Total issues: 1
  • Total pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: less than a minute
  • Total issue authors: 1
  • Total pull request authors: 1
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 1
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: less than a minute
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 1
  • Bot issues: 1
  • Bot pull requests: 0
Top Authors
Issue Authors
  • github-actions[bot] (1)
Pull Request Authors
  • Altaks (2)
Top Labels
Issue Labels
Pull Request Labels

Dependencies

.github/workflows/clippy.yml actions
  • Swatinem/rust-cache v2 composite
  • actions/checkout v3 composite
  • dtolnay/rust-toolchain stable composite
.github/workflows/covector-version-or-publish.yml actions
  • actions/checkout v3 composite
  • actions/setup-node v2 composite
  • jbolda/covector/packages/action covector-v0 composite
  • tauri-apps/create-pull-request v3 composite
.github/workflows/format.yml actions
  • Swatinem/rust-cache v2 composite
  • actions/checkout v3 composite
  • dtolnay/rust-toolchain stable composite
.github/workflows/test.yml actions
  • Swatinem/rust-cache v2 composite
  • actions/checkout v3 composite
  • dtolnay/rust-toolchain stable composite
Cargo.toml cargo
examples/tauri-app/src-tauri/Cargo.toml cargo
examples/tauri-app/package.json npm
  • @tauri-apps/cli ^1 development
  • @types/react ^18.2.15 development
  • @types/react-dom ^18.2.7 development
  • @vitejs/plugin-react ^4.2.1 development
  • typescript ^5.2.2 development
  • vite ^5.3.1 development
  • @tauri-apps/api ^1
  • react ^18.2.0
  • react-dom ^18.2.0
  • tauri-plugin-remote-caching-api file:../../
examples/tauri-app/pnpm-lock.yaml npm
  • ..
  • aix-ppc64@0.21.5
  • android-arm64@0.21.5
  • android-arm@0.21.5
  • android-x64@0.21.5
  • api@1.6.0
  • babel__core@7.20.5
  • babel__generator@7.6.8
  • babel__template@7.4.4
  • babel__traverse@7.20.6
  • cli-darwin-arm64@1.6.1
  • cli-darwin-x64@1.6.1
  • cli-linux-arm-gnueabihf@1.6.1
  • cli-linux-arm64-gnu@1.6.1
  • cli-linux-arm64-musl@1.6.1
  • cli-linux-x64-gnu@1.6.1
  • cli-linux-x64-musl@1.6.1
  • cli-win32-arm64-msvc@1.6.1
  • cli-win32-ia32-msvc@1.6.1
  • cli-win32-x64-msvc@1.6.1
  • cli@1.6.1
  • code-frame@7.24.7
  • compat-data@7.25.4
  • core@7.25.2
  • darwin-arm64@0.21.5
  • darwin-x64@0.21.5
  • estree@1.0.5
  • freebsd-arm64@0.21.5
  • freebsd-x64@0.21.5
  • gen-mapping@0.3.5
  • generator@7.25.6
  • helper-compilation-targets@7.25.2
  • helper-module-imports@7.24.7
  • helper-module-transforms@7.25.2
  • helper-plugin-utils@7.24.8
  • helper-simple-access@7.24.7
  • helper-string-parser@7.24.8
  • helper-validator-identifier@7.24.7
  • helper-validator-option@7.24.8
  • helpers@7.25.6
  • highlight@7.24.7
  • linux-arm64@0.21.5
  • linux-arm@0.21.5
  • linux-ia32@0.21.5
  • linux-loong64@0.21.5
  • linux-mips64el@0.21.5
  • linux-ppc64@0.21.5
  • linux-riscv64@0.21.5
  • linux-s390x@0.21.5
  • linux-x64@0.21.5
  • netbsd-x64@0.21.5
  • openbsd-x64@0.21.5
  • parser@7.25.6
  • plugin-react@4.3.1
  • plugin-transform-react-jsx-self@7.24.7
  • plugin-transform-react-jsx-source@7.24.7
  • prop-types@15.7.12
  • react-dom@18.3.0
  • react@18.3.5
  • remapping@2.3.0
  • resolve-uri@3.1.2
  • rollup-android-arm-eabi@4.21.2
  • rollup-android-arm64@4.21.2
  • rollup-darwin-arm64@4.21.2
  • rollup-darwin-x64@4.21.2
  • rollup-linux-arm-gnueabihf@4.21.2
  • rollup-linux-arm-musleabihf@4.21.2
  • rollup-linux-arm64-gnu@4.21.2
  • rollup-linux-arm64-musl@4.21.2
  • rollup-linux-powerpc64le-gnu@4.21.2
  • rollup-linux-riscv64-gnu@4.21.2
  • rollup-linux-s390x-gnu@4.21.2
  • rollup-linux-x64-gnu@4.21.2
  • rollup-linux-x64-musl@4.21.2
  • rollup-win32-arm64-msvc@4.21.2
  • rollup-win32-ia32-msvc@4.21.2
  • rollup-win32-x64-msvc@4.21.2
  • set-array@1.2.1
  • sourcemap-codec@1.5.0
  • sunos-x64@0.21.5
  • template@7.25.0
  • trace-mapping@0.3.25
  • traverse@7.25.6
  • types@7.25.6
  • win32-arm64@0.21.5
  • win32-ia32@0.21.5
  • win32-x64@0.21.5
package.json npm
  • @rollup/plugin-node-resolve 13.3.0 development
  • @rollup/plugin-typescript 8.3.3 development
  • rollup 2.75.6 development
  • rollup-plugin-terser 7.0.2 development
  • typescript 4.7.3 development
  • @tauri-apps/api ^1.0.0
  • tslib ^2.1.0
pnpm-lock.yaml npm
  • api@1.6.0
  • code-frame@7.24.7
  • estree@0.0.39
  • gen-mapping@0.3.5
  • helper-validator-identifier@7.24.7
  • highlight@7.24.7
  • node@22.5.2
  • plugin-node-resolve@13.3.0
  • plugin-typescript@8.3.3
  • pluginutils@3.1.0
  • resolve-uri@3.1.2
  • resolve@1.17.1
  • set-array@1.2.1
  • source-map@0.3.6
  • sourcemap-codec@1.5.0
  • trace-mapping@0.3.25