📮 load, write, and copy remote and local assets

Overview

axoasset

Github Actions Rust crates.io License: MPL 2.0

This library offers read, write, and copy functions, for local and remote assets given a string that contains a relative or absolute local path or a remote address using http or https.

Example

use axoasset;

let assets = vec!("https://my.co/logo.png", "./profile.jpg", "README.md");
let dest = "public";

for asset in assets {
    axoasset::copy(asset, dest)?;
}

License

This software is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

Copyright 2022 Axo Developer Co.

Comments
  • tests

    tests

    this PR set out to test the functionality of this pkg, and ended up adding some functionality. in sum, this PR:

    • adds functionality
      • [x] identify remote assets that don't have filename
      • [x] use mimetype to identify file type/extension for remote assets w/o filename
      • [x] async
    • adds tests for the following functionality:
      • [x] local asset copy
      • [x] local asset load
      • [x] local asset write
      • [x] remote asset copy
      • [x] remote asset load
      • [x] remote asset write

    the gnarliest part of this PR is identifying when a remote asset origin path does not contain a filename and then determining what that filename should be. the current logic looks to see if there is a . in the final segment of the URL- if it does, it writes the file using the text of that final segment, assuming it is a filename (this should be improved, #6). if it does not, it will check the mimetype and either use the (optional) extension field for the found mimetype, or use the extension associated with that mimetype (for images, this is given by the image crate). a lot of this is fiddly and relies on the server giving accurate data. there's a chance, long term, it may be easier for some users to just provide the file name they want.

    opened by ashleygwilliams 0
  • Support recursive copy of files

    Support recursive copy of files

    Right now axoasset only supports copying one asset at a time, it would be nice if it supported a recursive option where we could just pass a origin_folder and a dist_folder and it would copy the files and create the folders

    example code used in fs_extra: https://docs.rs/fs_extra/latest/src/fs_extra/lib.rs.html#190-223

    related https://github.com/axodotdev/oranda/pull/82

    opened by SaraVieira 0
  • type aliases for public api

    type aliases for public api

    per https://github.com/axodotdev/axoasset/pull/2#discussion_r1066591957 via @Gankra

    the api is rather stringly typed, for reasons i think are fair, but it would be useful for us internally to use type aliases to make clear what we're doing

    opened by ashleygwilliams 0
  • filenaming

    filenaming

    per https://github.com/axodotdev/axoasset/pull/2#discussion_r1066587304 via @Gankra

    currently if fetching a remote asset where the origin path is a url whose final segment is not identifiable as a filename, we do the following transform:

    https://mywebsite.com/some/path/image.png /some/path/image.png _some_path_image.png some_path_image.png

    for several reasons this is suboptimal and we should review this and how we name files in general.

    opened by ashleygwilliams 0
  • support receiving a batch of asset paths

    support receiving a batch of asset paths

    currently the API receives a single origin_path for an asset and fetches it. we should also introduce an API that can receive multiple origin_paths at once, be it a path to a dir, a vector, etc. it's not clear to me if we should pick one way (an iter?) or support multiple ways, of doing this, but in general this logic would not add a ton of complexity/maintenance burden (which is also why it seems ok to leave it up to the user to iterate through assets...)

    opened by ashleygwilliams 0
Owner
axo
axo
Load and resolve Cargo configuration.

cargo-config2 Load and resolve Cargo configuration. This library is intended to accurately emulate the actual behavior of Cargo configuration, for exa

Taiki Endo 6 Jan 10, 2023
Membrane is an opinionated crate that generates a Dart package from a Rust library. Extremely fast performance with strict typing and zero copy returns over the FFI boundary via bincode.

Membrane is an opinionated crate that generates a Dart package from a Rust library. Extremely fast performance with strict typing and zero copy returns over the FFI boundary via bincode.

Jerel Unruh 70 Dec 13, 2022
A lightning fast version of tmux-fingers written in Rust, copy/pasting tmux like vimium/vimperator

tmux-thumbs A lightning fast version of tmux-fingers written in Rust for copy pasting with vimium/vimperator like hints. Usage Press ( prefix + Space

Ferran Basora 598 Jan 2, 2023
Bongo Copy Cat wants to be involved in everything you do but instead just imitates you hitting your keyboard all day. After all it's just a cat.

Bongo Copy Cat Introduction Bongo Copy Cat wants to be involved in everything you do but instead just imitates you hitting your keyboard all day. Afte

Abhijeet Singh 4 Jan 23, 2023
One copy of Electron to rule them all.

chroma One copy of Electron to rule them all. chroma keeps a central, up-to-date version of Electron, and makes all your installed Electron apps use i

Gergő Móricz 12 Mar 20, 2023
🚧 (Alpha stage software) Binary that supports remote filesystem and process operations. 🚧

distant Binary to connect with a remote machine to edit files and run programs. ?? (Alpha stage software) This program is in rapid development and may

Chip Senkbeil 296 Dec 28, 2022
Mobile safari / webview remote debugging and e2e testing libraries

Canter (WIP) (WIP) Mobile safari / webview remote debugging and e2e testing libraries. Developed for safari/webview e2e testing on iPhone. Works only

Han Lee 9 Aug 16, 2022
Remoc 🦑 — Remote multiplexed objects and channels for Rust

Remoc ?? — remote multiplexed objects and channels Remoc makes remote interaction between Rust programs seamless and smooth. Over a single underlying

ENQT GmbH 98 Dec 21, 2022
A self-contained, single-binary Rust and Leptos application for remote Wake-on-LAN

Remote Wake-on-LAN with Rust and Leptos A self-contained, single-binary Rust and Leptos application serving a web interface to wake another device on

Valentin Bersier 6 Jan 28, 2023
🌲 Open the current remote repository in your browser

gitweb Some of the flags and options are subject to change in the future. Ideas are welcome. Ideas are bulletproof (V). gitweb is a command line inter

Yoann Fleury 26 Dec 17, 2022
Remote Secret Editor for AWS Secret Manager

Barberousse - Remote Secrets Editor About Usage Options Printing Editing Copying RoadMap 1.0 1.1 Future About A project aimed to avoid downloading sec

Mohamed Zenadi 18 Sep 28, 2021
Incremental, multi-version remote backup tool for block devices.

bsync Incremental, multi-version remote backup tool for block devices. The on-disk backup format is a SQLite database and I've been dogfooding this on

Heyang Zhou 7 Aug 21, 2022
M8 remote display - Rust

RM8 Remote display for the Dirtywave M8 I first tried M8WebDisplay then discovered m8c and decided to use it as a starting point for my own version in

Alex Boussinet 30 Dec 31, 2022
The system for remote workers to prevent their family members from interrupting conference calls

onair The system for remote workers to prevent their family members from interrupting conference calls. The system is designed to automatically detect

Yushi OMOTE 6 Sep 21, 2022
A convenient tracing config and init lib, with symlinking and local timezone.

clia-tracing-config A convenient tracing config and init lib, with symlinking and local timezone. Use these formats default, and can be configured: pr

Cris Liao 5 Jan 3, 2023
Noir Pay - Fork of the Light Protocol Program for local testing / optimisation.

Noir Pay v0 Built on Light Protocol Noir Pay will be directly built ontop of the Light Protocol SDK and provide users with a beautifully simple privat

0xNico 1 Feb 12, 2022
miette is a diagnostic library for Rust. It includes a series of traits/protocols that allow you to hook into its error reporting facilities, and even write your own error reports!

miette is a diagnostic library for Rust. It includes a series of traits/protocols that allow you to hook into its error reporting facilities, and even write your own error reports!

Kat Marchán 1.2k Jan 1, 2023
write licenses to stdout

licensor write licenses to stdout About Write a license to standard output given its SPDX ID. A name for the copyright holder can optionally be provid

Raphaël Thériault 163 Dec 1, 2022
Cargo subcommand to easily bootstrap nocode applications. Write nothing; deploy nowhere.

cargo-nocode No code is the best way to write secure and reliable applications. Write nothing; deploy nowhere. cargo-nocode aims to bring the nocode a

Orhun Parmaksız 29 Jul 1, 2023