Skip to content

Commit

Permalink
feat: initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
baszalmstra committed Oct 22, 2023
0 parents commit 1dd7ef3
Show file tree
Hide file tree
Showing 9 changed files with 956 additions and 0 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/rust-compile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
on:
push:
branches:
- "main"
pull_request:

name: Rust

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
RUST_LOG: info
RUST_BACKTRACE: 1
RUSTFLAGS: "-D warnings"
CARGO_TERM_COLOR: always

jobs:
check-rustdoc-links:
name: Check intra-doc links
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo rustdoc --all-features -- -D warnings -W unreachable-pub

format_and_lint:
name: Format and Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: clippy, rustfmt
- name: Run rustfmt
uses: actions-rust-lang/rustfmt@v1
- name: Run clippy
run: cargo clippy

build:
name: ubuntu-latest
runs-on: ubuntu-latest
needs: [ format_and_lint ]
steps:
- name: Checkout source code
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt
- name: Build
run: cargo build
- name: Run tests
run: cargo test -- --nocapture
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Generated by Cargo
# will have compiled files and executables
/target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
/Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# These are files generated by IntelliJ IDEA
.idea/
47 changes: 47 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
[package]
name = "async_http_range_reader"
authors = ["Bas Zalmstra <[email protected]>"]
version = "0.1.0"
edition = "2021"
description = "A library for streaming reading of files over HTTP using range requests"
license = "MIT"
repository = "https://github.com/baszalmstra/async_http_range_reader"
exclude = ["test-data/*"]

[dependencies]
futures = "0.3.28"
http-content-range = "0.1.2"
itertools = "0.11.0"
bisection = "0.1.0"
memmap2 = "0.9.0"
reqwest = { version = "0.11.22", default-features = false, features = ["stream"] }
tokio = { version = "1.33.0", default-features = false }
tokio-stream = { version = "0.1.14", features = ["sync"] }
tokio-util = "0.7.9"
thiserror = "1.0.50"
tracing = "0.1.40"

[dev-dependencies]
axum = { version = "0.6.20", default-features = false, features = ["tokio"] }
tokio = { version = "1.33.0", default-features = false, features = ["macros", "test-util"] }
tower-http = { version = "0.4.4", default-features = false, features = ["fs"] }
async_zip = { version = "0.0.15", default-features = false, features = ["tokio"] }
assert_matches = "1.5.0"

# The profile that 'cargo dist' will build with
[profile.dist]
inherits = "release"
lto = "thin"

# Config for 'cargo dist'
[workspace.metadata.dist]
# The preferred cargo-dist version to use in CI (Cargo.toml SemVer syntax)
cargo-dist-version = "0.3.1"
# CI backends to support
ci = ["github"]
# The installers to generate for each app
installers = []
# Target platforms to build apps for (Rust target-triple syntax)
targets = ["x86_64-unknown-linux-gnu", "aarch64-apple-darwin", "x86_64-apple-darwin", "x86_64-pc-windows-msvc"]
# Publish jobs to run in CI
pr-run-mode = "plan"
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Bas Zalmstra

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Async HTTP Range Reader

[![Crates.io](https://img.shields.io/crates/v/async_http_range_reader?style=flat-square)](https://crates.io/crates/async_http_range_reader)
[![docs.rs](https://img.shields.io/docsrs/async_http_range_reader?style=flat-square)](https://docs.rs/async_http_range_reader/)
[![GitHub Workflow Status (branch)](https://img.shields.io/github/actions/workflow/status/baszalmstra/async_http_range_reader/rust-compile.yml?branch=main&style=flat-square)](https://github.com/baszalmstra/async_http_range_reader/actions?query=branch%3Amain)
[![GitHub](https://img.shields.io/github/license/baszalmstra/async_http_range_reader?style=flat-square)](https://github.com/baszalmstra/async_http_range_reader/blob/main/LICENSE)

A crate that provides the `AsyncHttpRangeReader` struct, which allows streaming files over HTTP using range requests.
Loading

0 comments on commit 1dd7ef3

Please sign in to comment.