
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
numpy-loader
Advanced tools
A webpack loader for binary numpy .npy files
Configure the loader in your webpack.config.js
under module
> rules
, e.g. like this:
{
test: /\.(npy|npc)$/,
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 ndarray
s in your JS code simply by require
ing them. There are two modes, for small and large npy files respectively:
Load small .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 = require("numpy-loader?embed=true!./data/array_uint8.npy");
console.log("Loaded array in JS directly from packed module: " + npyarray.constructor.name);
console.log(npyarray);
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 = require("numpy-loader?embed=false!./data/array_uint8.npy")
npyarray.load( (array) => {
console.log("Loaded an .npy array in JS!");
console.log(array);
})
FAQs
A webpack loader for binary numpy .npy files
The npm package numpy-loader receives a total of 62 weekly downloads. As such, numpy-loader popularity was classified as not popular.
We found that numpy-loader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.