
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
jsfive is a library for reading (not writing) HDF5 files using pure javascript, such as in the browser. It is based on the pyfive pure-python implementation of an HDF5 reader. Not all features of HDF5 are supported, but some key ones that are:
It is only for reading HDF5 files as an ArrayBuffer representation of the file.
If you need to write HDF5 files in javascript consider using h5wasm (github, npm) instead (also provides efficient slicing of large datasets, and uses direct filesystem access in nodejs).
If you want to use it as an old-style ES5 script, you can use the pre-built library in /dist/hdf5.js e.g.
<script src="https://cdn.jsdelivr.net/npm/jsfive@0.3.10/dist/browser/hdf5.js"></script>
To include in a project,
npm install jsfive
then in your project
import * as hdf5 from 'jsfive';
// this works in create-react-app too, in
// jsfive >= 0.3.7
or
const hdf5 = await import("jsfive");
With fetch, from the browser:
fetch(file_url)
.then(function(response) {
return response.arrayBuffer()
})
.then(function(buffer) {
var f = new hdf5.File(buffer, filename);
// do something with f;
// let g = f.get('group');
// let d = f.get('group/dataset');
// let v = d.value;
// let a = d.attrs;
});
Or if you want to upload a file to work with, into the browser:
function loadData() {
var file_input = document.getElementById('datafile');
var file = file_input.files[0]; // only one file allowed
let datafilename = file.name;
let reader = new FileReader();
reader.onloadend = function(evt) {
let barr = evt.target.result;
var f = new hdf5.File(barr, datafilename);
// do something with f...
}
reader.readAsArrayBuffer(file);
file_input.value = "";
}
in node REPL (might require --experimental-repl-await for older nodejs)
$ node
Welcome to Node.js v16.13.2.
Type ".help" for more information.
> const hdf5 = await import("jsfive");
undefined
> var fs = require("fs");
undefined
> var ab = fs.readFileSync("/home/brian/Downloads/sans59510.nxs.ngv");
undefined
> var f = new hdf5.File(ab.buffer);
undefined
> f.keys
[ 'entry' ]
> f.get("entry").attrs
{ NX_class: 'NXentry' }
>
FAQs
A pure javascript HDF5 file reader, based on pyfive
The npm package jsfive receives a total of 744 weekly downloads. As such, jsfive popularity was classified as not popular.
We found that jsfive demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.