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 🙏

© 2026 – Pkg Stats / Ryan Hefner

tauri-plugin-fs-stream-api

v2.0.0

Published

File Streaming API for Tauri

Readme

Note: I’m using a translation tool, so there may be some inappropriate expressions.

Overview

This plugin provides commands that create ReadableStream and WritableStream from a file path.

Setup

First, install this plugin to your Tauri project:

src-tauri/Cargo.toml

[dependencies]
tauri-plugin-fs-stream = "=2.0.0"

Next, register this plugin in your Tauri project:

src-tauri/src/lib.rs

#[cfg_attr(mobile, tauri::mobile_entry_point)]
pub fn run() {
    tauri::Builder::default()
        .plugin(tauri_plugin_fs_stream::init()) // This
        .run(tauri::generate_context!())
        .expect("error while running tauri application");
}

Then, set the APIs and file paths that can be used from the Javascript:

src-tauri/capabilities/*.json

{
    "permissions": [
        {
            "identifier": "fs-stream:allow-open-read-file-stream",
            "allow": ["$APPDATA/my-data/**/*"]
        },
        {
            "identifier": "fs-stream:allow-open-write-file-stream",
            "allow": ["$APPDATA/my-data/**/*"],
            "deny": ["$APPDATA/my-data/readonly/**/*"]
        }
    ]
}

Finally, install the JavaScript Guest bindings using whichever JavaScript package manager you prefer:

pnpm add [email protected] -E
# or
npm install [email protected] --save-exact
# or
yarn add [email protected] --exact

NOTE: Please make sure that the Rust-side tauri-plugin-fs-stream and the JavaScript-side tauri-plugin-fs-stream-api versions match exactly.

API

This plugin provides the following commands:

  • openReadFileStream
  • openReadTextFileLinesStream
  • openWriteFileStream
  • closeAllFileStreams
  • countAllFileStreams

Example

import { openReadFileStream, openWriteFileStream } from "tauri-plugin-fs-stream-api";

async function convertFile(
  inputPath: string,
  outputPath: string,
  convertor: TransformStream<Uint8Array<ArrayBuffer>, Uint8Array>
) {

  let input: ReadableStream<Uint8Array<ArrayBuffer>> | null = null
  let output: WritableStream<Uint8Array> | null = null
  try {
    input = await openReadFileStream(inputPath)
    output = await openWriteFileStream(outputPath)
    await input.pipeThrough(convertor).pipeTo(output)
  }
  catch (e) {
    await input?.cancel().catch(() => {})
    await output?.abort().catch(() => {})
    throw e
  }
}

File Access

Access control for file paths follows the same model as the fs plugin.

This plugin prevents path traversal and can access only the paths explicitly declared in the capability file.

An exception applies to files that the user explicitly selects through drag and drop or via the dialog plugin. Such files are accessible even if they are not declared in the capability configuration. And these permissions can be persisted using the persisted scope plugin, allowing access to remain available across application restarts. Note that to use these features, the fs plugin must be set up in your Tauri project.

Optional Settings

As with the fs plugin, you can configure plugins.fs-stream.requireLiteralLeadingDot in src-tauri/tauri.conf.json.

You can also use the "fs-stream:scope" permission in the capability file to define allowed and denied paths for all commands.

License

This project is licensed under either of

  • MIT license
  • Apache License (Version 2.0)

at your option.