#svg #image #data #testing #whether

is-svg

Test whether a given data is a SVG image

3 releases

0.1.2 Sep 22, 2024
0.1.1 Jul 17, 2024
0.1.0 Jul 13, 2024

#623 in Images

Download history 146/week @ 2024-07-08 194/week @ 2024-07-15 205/week @ 2024-07-22 66/week @ 2024-07-29 4/week @ 2024-08-05 1/week @ 2024-08-12 9/week @ 2024-08-19 23/week @ 2024-08-26 2/week @ 2024-09-02 16/week @ 2024-09-09 215/week @ 2024-09-16 164/week @ 2024-09-23

402 downloads per month
Used in qrtool

Apache-2.0 OR MIT

25KB

is-svg

CI Version MSRV Docs License

is-svg is a Rust library for testing whether a given data is a SVG image.

Usage

Add this to your Cargo.toml:

[dependencies]
is-svg = "0.1.2"

Example

assert_eq!(
    is_svg::is_svg(include_str!("tests/data/w3/svg-logo-v.svg")),
    true
);
assert_eq!(
    is_svg::is_svg(include_bytes!("tests/data/w3/svg-logo-v.png")),
    false
);

// `.svgz` is also supported.
assert_eq!(
    is_svg::is_svg(include_bytes!("tests/data/w3/svg-logo-v.svgz")),
    true
);

Documentation

See the documentation for more details.

Minimum supported Rust version

The minimum supported Rust version (MSRV) of this library is v1.74.0.

Source code

The upstream repository is available at https://github.com/sorairolake/is-svg.git.

The source code is also available at:

Changelog

Please see CHANGELOG.adoc.

Contributing

Please see CONTRIBUTING.adoc.

License

Copyright © 2024 Shun Sakai (see AUTHORS.adoc)

This library is distributed under the terms of either the Apache License 2.0 or the MIT License.

This project is compliant with version 3.2 of the REUSE Specification. See copyright notices of individual files for more details on copyright and licensing information.

Dependencies

~3MB
~62K SLoC