0.0.33 • Published 12 months ago

hdf5-io v0.0.33

Weekly downloads
-
License
AGPL-3.0-or-later
Repository
github
Last release
12 months ago

hdf5-io

Simple utility for reading / writing HDF5 files on the browser

status downloads lic

Description

hdf5-io is a simple utility for handling reading / writing HDF5IO files. As an extension to the h5wasm library, it immediately emits and consumes JavaScript objects containing all the relevent data.

Getting Started

// Import hdf5-io Library
import HDF5IO from "https://cdn.jsdelivr.net/npm/hdf5-io/dist/index.esm.js";

// Initialize HDF5IO instance (all optional parameters)
const io = new HDF5IO(
    {
        postprocess: (hdf5Object) => hdf5Object,
        debug: true
    },
    
)

await io.initFS('/hdf5-test') // initialize local filesystem

// load a remote file
const file = await io.fetch(
     'https://raw.githubusercontent.com/OpenSourceBrain/NWBShowcase/master/FergusonEtAl2015/FergusonEtAl2015.nwb', // URL to get file from
    'FergusonEtAl2015.nwb',  // Save the file with this name
    (ratio) => console.log('Load Status', `${(ratio * 100).toFixed(2)}%`),
    (remote) => console.log('Origin', (remote) ? path : 'Local')
)

// save the file to local storage
const filename = io.save(file)

// list files in local storage
const files = await io.list()

// get specific file from local storage
const lsFile = await io.load(filename)

Conventions

Datasets

When reading an HDF5 file, both datasets and attributes are transformed into JavaScript objects that hold their respective metadata:

const datasetValue = 1 // From HDF5 file
const output = new Number(datasetValue)

If you are adding a new dataset, this must be an Object when written to the file:

const object = {
    dataset: new Number(1),
    attribute: 1
}

Known Issues

Acknowledgments

hdf5-io was originally prototyped by Garrett Flynn as the WebNWB project at the 2022 NWB-DANDI Remote Developer Hackathon.

0.0.20

1 year ago

0.0.21

1 year ago

0.0.22

1 year ago

0.0.23

1 year ago

0.0.24

1 year ago

0.0.25

1 year ago

0.0.30

12 months ago

0.0.31

12 months ago

0.0.32

12 months ago

0.0.33

12 months ago

0.0.26

1 year ago

0.0.27

1 year ago

0.0.28

1 year ago

0.0.29

12 months ago

0.0.10

1 year ago

0.0.11

1 year ago

0.0.12

1 year ago

0.0.13

1 year ago

0.0.14

1 year ago

0.0.15

1 year ago

0.0.16

1 year ago

0.0.17

1 year ago

0.0.18

1 year ago

0.0.19

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.5

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago

0.0.0

2 years ago