.npy (single array), .npz (multiple arrays), and delimited text files. All functions are available from the main numpy-ts entry point.
File-based functions read and write files on disk and require a server runtime (Node.js, Bun, or Deno). In the browser, they throw: “File IO requires Node.js, Bun, or Deno. In the browser, use parseNpy(buffer) / parseTxt(text) with fetch() instead.” Buffer-based functions work with
ArrayBuffer, Uint8Array, and strings in all environments.NPY files (single array)
The.npy format stores a single array with its dtype and shape metadata.
- File-based (Node / Bun / Deno)
- Buffer-based (all environments)
NPZ archives (multiple arrays)
The.npz format stores multiple named arrays in a single ZIP archive. savez_compressed applies deflate compression.
- File-based (Node / Bun / Deno)
- Buffer-based (all environments)
Text files
Load and save delimited text files such as CSV and TSV.- File-based (Node / Bun / Deno)
- Buffer-based (all environments)
Flexible text loading
genfromtxt
Likeloadtxt, but handles missing values more gracefully.
- File-based (Node / Bun / Deno)
- Buffer-based (all environments)
fromregex
Extract numeric data from unstructured text using regular expressions.- File-based (Node / Bun / Deno)
- Buffer-based (all environments)