h5jam(1)
β¨ h5jam β the manual page, but make it cute β¨
okay so bestie, welcome to h5jam(1), a classic from the General Commands Manual lineup π
this is the little tool that glues a user block onto your HDF5 file, and honestly? it's giving main character energy.
π NAME π
h5jam β add a user block to a HDF5 file. that's it, that's the job, and it does it flawlessly.
π¦ SYNOPSIS π¦
h5jam -u user_block -i in_file.h5 [-o out_file.h5] [--clobber]
πΈ DESCRIPTION πΈ
so here's the tea, bestie π h5jam concatenates a user_block file and an HDF5 file together to make an HDF5 file with a user block. and ngl, that user block can be either binary or text β no judgment either way, both are valid, both are iconic. the output file gets padded so that the HDF5 header starts on byte 512, 1024, etc.. (see the HDF5 File Format for the deets π)
now, the two vibes of running this:
- if
out_file.h5is given, a new file is created with theuser_blockfollowed by the contents ofin_file.h5. and in this case?infile.h5stays unchanged π«Ά it's fine, it's safe, it's untouched. - if
out_file.h5is not specified, then theuser_blockis just added toin_file.h5directly. no new file, we're editing in place, periodt.
and here's the plot twist π if in_file.h5 already has a user block, then the contents of user_block will be added to the end of the existing user block, and the file gets shifted to the next boundary. but if --clobber is set, any existing user block will be overwritten β gone, deleted, not coming back, rip to that old block π
π₯ EXAMPLE USAGE π₯
1. create a new file, newfile.h5, with the text in file mytext.txt as the user block for the HDF5 file file.h5.
h5jam -u mytext.txt -i file.h5 -o newfile.h5
2. add text in file mytext.txt to the front of HDF5 dataset, file.h5.
h5jam -u mytext.txt -i file.h5
3. overwrite the user block (if any) in file.h5 with the contents of mytext.txt.
h5jam -u mytext.txt -i file.h5 --clobber
π RETURN VALUE π
h5jam returns the size of the output file, or -1 if an error occurs. so like, big number = slay, -1 = we're crying in the club π
β CAVEATS β
okay bestie, listen, this is the part where we get real π«Ά
- this tool copies all the data (sequentially) in the file(s) to new offsets. for a large file, this copy will take a long time. like, go make a snack, watch a whole show, it's not fast. π
- the most efficient way to create a user block is to create the file with a user block (see
H5Pset_user_block), and write the user block data into that space from a program. that's the speedrun route π₯ - the user block is completely opaque to the HDF5 library and to the
h5jamandh5unjamtools. it's simply read or written as a string of bytes, which could be text or any kind of binary data. it is up to the user to know what the contents of the user block means and how to process it. no cap, that's on you π - when the user block is extracted, all the data is written to the output, including any padding or unwritten data. yes, even the weird empty parts. all of it. π
- this tool moves the HDF5 file through byte copies, i.e., it does not read or interpret the HDF5 objects. it's just moving bytes around, it doesn't care what's inside, it's not nosy, it's just strong πͺ
π SEE ALSO π
h5dump(1), h5ls(1), h5diff(1), h5import(1), gif2h5(1), h52gif(1), h5perf(1), h5unjam(1).
go read those too, they're all part of the fam π§
and that's the whole page, bestie β¨ this one's from the General Commands Manual, page h5jam(1) β go forth and jam those user blocks on, you absolute icon ππ
π¦ where this page comes from
- debian bookworm: hdf5-tools 1.10.8+repack1-1 Β· BSD-3-Clause
- debian trixie: hdf5-tools 1.14.5+repack-3 Β· BSD-3-Clause
- epel 10: hdf5 1.14.5-1.el10_0 Β· BSD-3-Clause
- epel 9: hdf5 1.12.1-7.el9.1 Β· BSD
- fedora 43: hdf5 1.14.6-6.fc43 Β· BSD-3-Clause
- fedora 43: hdf5 1.14.6-6.fc43 Β· BSD-3-Clause
- fedora 44: hdf5 1.14.6-7.fc44 Β· BSD-3-Clause
- fedora 44: hdf5 1.14.6-7.fc44 Β· BSD-3-Clause
- ubuntu jammy: hdf5-tools 1.10.7+repack-4ubuntu2 Β· BSD-3-Clause
- ubuntu noble: hdf5-tools 1.10.10+repack-3.1ubuntu4 Β· BSD-3-Clause
- ubuntu questing: hdf5-tools 1.14.5+repack-3build1
- ubuntu resolute: hdf5-tools 1.14.6+repack-2 Β· BSD-3-Clause
- ubuntu stonking: hdf5-tools 2.2.0+repack-5 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms