package swhid

  1. Overview
  2. Docs
OCaml library to work with Software Heritage identifiers

Install

Dune Dependency

Authors

Maintainers

Sources

0.1.tar.gz
sha256=1ca94411004d45b42194ed70754993592dffc1b5836c15276ed81d2e92f662fb
sha512=80ba0f2e795305e3a0084018216e6ae95690a074e322de24076b4829afc8afc4dc9240534dd88a22779f6ccf1e5bf78dee9a1aedaba3a2209a3c3a0f4d66711b

README.md.html

swhid

swhid is an OCaml library to work with persistent identifiers found in Software Heritage, also known as swhid. It provides:

  • a parser and a printer for swhid

  • functions to compute a swhid for a given object (content, directory, revision, release, snapshot)

  • functions to query the swh API in order to get an URL from which you can download a given object

Installation

swhid can be installed with opam:

opam install swhid

If you don't have opam, you can install it following the how to install opam guide.

If you can't or don't want to use opam, consult the opam file for build instructions.

Quickstart

let id = "swh:1:rev:db21f0afdb54c16b265754ca599869fda0ca4bfc"

let url =
  match Swhid.Parse.from_string id with
  | Error e -> Error e
  | Ok id -> Swhid.Download.revision id

let () =
  match url with
  | Error e -> Format.eprintf "can't get download URL: `%s`@." e
  | Ok url ->
    Format.printf "you can download the revision at the URL: `%s`@." url

For more, have a look at the example folder, at the documentation or at the test suite.

About

OCaml

Innovation. Community. Security.