nbdkit_parse_size(3)
π nbdkit_parse_size β the manual page, bestie edition π
okay so welcome to nbdkit_parse_size(3), a page from the NBDKIT manual, section 3. sit down, grab a boba, we're parsing sizes and we're gonna eat π
β¨ NAME β¨
nbdkit_parse_size β parse human-readable size strings for nbdkit
like, you say 100M and it's like "oh word, that's a number of bytes" π
no cap.
πΈ SYNOPSIS πΈ
#include <nbdkit-plugin.h>
int64_t nbdkit_parse_size (const char *str);
there it is. one function. one job. iconic behaviour honestly π
π¦ DESCRIPTION π¦
so you're gonna use the nbdkit_parse_size utility function to parse human-readable size strings like "100M" and turn them into the size in bytes. that's the whole vibe. that's the assignment. and it ate. π₯
the str parameter is a string, and it can be in a number of common formats. yes bestie, formats, plural β that's not me being vague, that's just what the page says, so we keep it π
π RETURN VALUE π
- the function returns the size in bytes π
- but if there's an error? plot twist π it calls
nbdkit_error(3)and returns-1.
lowkey important: -1 means something went wrong, not "negative one bytes of storage". check your error handling fr fr π
π LANGUAGE BINDINGS π
bestie it's polyglot, it speaks everyone's language π
π In nbdkit-ocaml-plugin(3):
NBDKit.parse_size : string -> int64
π In nbdkit-python-plugin(3):
import nbdkit
size = nbdkit.parse_size(str)
π In nbdkit-rust-plugin(3):
use nbdkit::*;
pub fn parse_size(s: &str) -> Result<i64>
π In nbdkit-sh-plugin(3):
okay so here's the cute part β nbdkit_parse_size gets called implicitly to parse the output of get_size and other methods. you don't even have to ask. it just shows up. main character energy β¨
π HISTORY π
nbdkit_parse_size was present in nbdkit 0.1.0. so like, day one. OG status. it's been here since the beginning and we respect it π«Ά
π SEE ALSO π
go read these next, they're all part of the friend group:
nbdkit(1)nbdkit_parse_bool(3)nbdkit_parse_delay(3)nbdkit_parse_int(3)nbdkit_parse_probability(3)nbdkit-plugin(3)nbdkit-filter(3)
π AUTHORS π
Richard W.M. Jones
(the legend themselves, we stan π)
πΈ COPYRIGHT πΈ
Copyright Red Hat
π LICENSE π
okay bestie, legal time, but make it cute. redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of Red Hat nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY RED HAT AND CONTRIBUTORS ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL RED HAT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
fr fr read that one, it's the "no promises, don't sue us" clause and it means exactly what it says π
and that's the page!! this was nbdkit-1.48.1, dated 2026-08-29, and it lives in the nbdkit family forever. mwah π go parse some sizes, bestie, you're gonna slay π¦β¨π
π¦ where this page comes from
- fedora 44: nbdkit-devel 1.48.1-1.fc44 Β· BSD-3-Clause
- fedora 44: nbdkit-devel 1.48.1-1.fc44 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms