1.0.4 • Published 5 years ago
read-npy-file v1.0.4
read-npy-file
Install
npm i read-npy-file
Usage
import readNumpyFile from 'read-npy-file'
const dataArray = readNumpyFile('data.npy')
console.log(
{
// The DataArray result
dataArray,
// 'typedArray' is a TypedArray. see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray
typedArray: dataArray.typedArray,
// The shape of the numpy array
shape: dataArray.shape,
// Converts the flat TypedArray into a nested normal array equivalent to what it would be in python.
array: dataArray.toArray(),
// Converts to json string.
json: dataArray.toJson(),
}
)