tus-protocol 0.1.0

Rust implementation of the TUS resumable upload protocol
[package]
name = "tus-protocol"
version.workspace = true
description = "Rust implementation of the TUS resumable upload protocol"
edition.workspace = true
rust-version.workspace = true
license.workspace = true
repository.workspace = true
homepage.workspace = true
keywords = ["tus", "upload", "resumable", "http", "protocol"]
categories = ["web-programming::http-server", "network-programming", "asynchronous"]

[features]
default = []

# Platform features.
#
# `native` is an internal building block bundling the native async runtime for
# the file-backed backends below; the `dep:` form keeps the optional
# dependencies from leaking implicit public features.
native = ["dep:tokio", "dep:tokio-util"]

# Conformance suites
conformance-lock = ["tokio/time"]
conformance-state = []
conformance-storage = []

# Storage implementations
storage-file = ["native", "tokio/fs", "tokio/io-util"]
storage-memory = []

# State storage implementations
state-file = ["native", "dep:serde_json", "tokio/fs", "tokio/io-util"]
state-memory = []

# Locking implementations
lock-file = ["native", "dep:fs2", "tokio/fs", "tokio/rt", "tokio/time"]
lock-memory = ["native", "tokio/sync", "tokio/time"]

# Checksum implementations
checksum = ["dep:crc32fast", "dep:md5", "dep:sha1", "dep:sha2"]

# Internal-only hooks for fuzz harnesses.
fuzzing = []

[dependencies]
async-trait = { workspace = true }
base64 = { workspace = true }
bytes = { workspace = true }
chrono = { workspace = true }
fs2 = { version = "0.4", optional = true }
futures-core = { workspace = true }
futures-util = { workspace = true }
http = { workspace = true }
percent-encoding = { workspace = true }
serde = { workspace = true, features = ["derive"] }
# Only the file-backed state store serializes to JSON; gated under `state-file`
# via `dep:serde_json`. Tests use it unconditionally through dev-dependencies.
serde_json = { workspace = true, optional = true }
thiserror = { workspace = true }
tracing = { workspace = true }
uuid = { workspace = true, features = ["v4"] }

# Optional - native runtime
tokio = { workspace = true, optional = true }
tokio-util = { version = "0.7", features = ["io"], optional = true }

# Optional - Checksum
crc32fast = { version = "1", optional = true }
md5 = { version = "0.8", optional = true }
sha1 = { version = "0.11", optional = true }
sha2 = { workspace = true, optional = true }

# On wasm32, uuid's v4 RNG needs an explicit
# randomness source. The `js` feature routes it through js-sys'
# crypto.getRandomValues(), which workerd provides.
[target.'cfg(target_arch = "wasm32")'.dependencies]
uuid = { workspace = true, features = ["v4", "js"] }

[dev-dependencies]
futures = { workspace = true }
serde_json = { workspace = true }
tempfile = { workspace = true }
tokio = { workspace = true, features = ["macros", "rt-multi-thread", "sync", "time"] }

# docs.rs builds the public backend surface, excluding the internal-only
# `fuzzing` and `conformance-*` features.
[package.metadata.docs.rs]
features = [
    "native",
    "storage-file",
    "storage-memory",
    "state-file",
    "state-memory",
    "lock-file",
    "lock-memory",
    "checksum",
]
rustdoc-args = ["--cfg", "docsrs"]