A webpack loader for binary numpy .npy files
Configure the loader in your
rules, e.g. like this:
test: /\.$/exclude: /node_modules/loader: 'numpy-loader'options:outputPath: 'assets/data'
You can specify an
outputPath that will be used during compilation.
You can now load
.npy files as
ndarrays in your JS code simply by
requireing them. There are two modes, for small and large npy files respectively:
.npy files directly from the webpack bundle using
embed=true. These files will be base64 encoded and become a part of your webpack bundle.
let npyarray = ;console;console;
You might not want to embed particularly large files in your webpack bundle. You can specify
embed=false (or nothing; it's the default) to copy your
.npy files to your output directory and load them as binary files from your server at runtime instead. Thus you need to use the
#load() callback like this:
const npyarray =npyarray