nbdkit_parse_size3
Parse human-readable size strings for nbdkit
Usage
#include <nbdkit-plugin.h>int64_t nbdkit_parse_size (const char *str);
Overview
Use the "nbdkit_parse_size" utility function to parse human-readable size strings such as "100M" into the size in bytes.
The "str" parameter is a string in a number of common formats.
Return value
The function returns the size in bytes.
If there is an error it calls nbdkit_error(3) and returns -1.
Language bindings
In nbdkit-ocaml-plugin(3):
NBDKit.parse_size : string -> int64
import nbdkitsize = nbdkit.parse_size(str)
In nbdkit-rust-plugin(3):
use nbdkit::*;pub fn parse_size(s: &str) -> Result<i64>
In nbdkit-sh-plugin(3), "nbdkit_parse_size" is called implicitly to parse the output of "get_size" and other methods.