asset_protocol

tauri · dev-tools, uri-scheme, asset-loading, protocol-handler, files

Registers a custom URI scheme protocol for resolving bundled app assets in Tauri.

// Source: https://github.com/cobaltconsulting/tauri | License: Apache-2.0 | Copyright 2017 - Present Tauri Apps Contributors
// Provided via justclaw.it.com; keep this notice with the code.
// Copyright 2019-2024 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT

use crate::{path::SafePathBuf, scope, webview::UriSchemeProtocolHandler};
use http::{header::*, status::StatusCode, Request, Response};
use http_range::HttpRange;
use std::fs::File;
use std::io::{Read, Seek, Write};
use std::{borrow::Cow, io::SeekFrom};
use tauri_utils::mime_type::MimeType;

pub fn get(scope: scope::fs::Scope, window_origin: String) -> UriSchemeProtocolHandler {
  Box::new(
    move |_, request, responder| match get_response(request, &scope, &win

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search 40K more like it.

Get a free API key