numcodecs
Advanced tools
Comparing version 0.0.11 to 0.0.12
@@ -1,3 +0,1 @@ | ||
import { CompressorConfig, Codec } from './types'; | ||
declare function getCodec<T extends Codec>(config: CompressorConfig): Promise<T>; | ||
export { getCodec }; | ||
export declare const registry: Map<any, any>; |
{ | ||
"name": "numcodecs", | ||
"author": "Trevor James Manz", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"description": "Buffer compression and transformation codecs for use in data storage and communication applications.", | ||
"type": "module", | ||
"main": "dist/numcodecs/index.js", | ||
"main": "dist/index.js", | ||
"module": "dist/index.module.js", | ||
"exports": { | ||
".": "./dist/numcodecs/index.js", | ||
"./dynamic-registry": "./dist/numcodecs/dynamic-registry.js", | ||
"./codecs/": "./dist/numcodecs/codecs/", | ||
"./package.json": "./package.json" | ||
".": { | ||
"browser": "./dist/index.module.js", | ||
"import": "./dist/index.mjs", | ||
"require": "./dist/index.js" | ||
}, | ||
"./gzip": { | ||
"browser": "./dist/gzip.module.js", | ||
"umd": "./dist/gzip.umd.js", | ||
"import": "./dist/gzip.mjs", | ||
"require": "./dist/gzip.js" | ||
}, | ||
"./zlib": { | ||
"browser": "./dist/zlib.module.js", | ||
"umd": "./dist/zlib.umd.js", | ||
"import": "./dist/zlib.mjs", | ||
"require": "./dist/zlib.js" | ||
} | ||
}, | ||
@@ -19,3 +32,3 @@ "repository": { | ||
"scripts": { | ||
"build": "tsc --emitDeclarationOnly && rollup -c", | ||
"build": "rollup -c", | ||
"prebuild": "rm -rf dist", | ||
@@ -41,16 +54,17 @@ "lint": "tsc --noEmit && eslint ./src/**/*.ts --quiet --fix", | ||
"devDependencies": { | ||
"@rollup/plugin-commonjs": "^11.0.2", | ||
"@rollup/plugin-node-resolve": "^7.1.1", | ||
"@rollup/plugin-typescript": "^3.0.0", | ||
"@types/jest": "^25.1.3", | ||
"@rollup/plugin-commonjs": "^11.1.0", | ||
"@rollup/plugin-node-resolve": "^7.1.3", | ||
"@rollup/plugin-typescript": "^4.1.1", | ||
"@types/jest": "^25.2.1", | ||
"@types/pako": "^1.0.1", | ||
"@typescript-eslint/eslint-plugin": "^2.22.0", | ||
"@typescript-eslint/parser": "^2.22.0", | ||
"@typescript-eslint/eslint-plugin": "^2.31.0", | ||
"@typescript-eslint/parser": "^2.31.0", | ||
"eslint": "^6.8.0", | ||
"jest": "^25.1.0", | ||
"prettier": "1.19.1", | ||
"rollup": "^1.32.0", | ||
"ts-jest": "^25.2.1", | ||
"jest": "^25.0.0", | ||
"prettier": "2.0.5", | ||
"rollup": "^2.7.6", | ||
"rollup-plugin-terser": "^5.3.0", | ||
"ts-jest": "^25.4.0", | ||
"tslib": "^1.11.1", | ||
"typescript": "^3.8.0" | ||
"typescript": "^3.8.3" | ||
}, | ||
@@ -57,0 +71,0 @@ "prettier": { |
# numcodecs | ||
Examples: | ||
Some experiments with Node.js 14.1 [module exports](https://nodejs.org/api/modules.html). | ||
```javascript | ||
// import entire registry | ||
import { getCodec } from 'numcodecs'; | ||
const codec = getCodec({id: 'gzip', level: 1}); | ||
// use a dynamic registry, utilizing dynamic imports | ||
import { getCodec } from 'numcodecs/dynamic-registry'; | ||
const codec = await getCodec({id: 'gzip', level: 1}); | ||
// import individual codecs | ||
import GZip from 'numcodecs/codec/gzip.js'; | ||
const codec = new GZip(1); | ||
// Usage | ||
const arr = new Float32Array([1, 2, 3, 4, 5, 6]); | ||
const encoded = codec.encode(new Uint8Array(arr.buffer)); | ||
const decoded = coded.decode(encoded); | ||
console.log(new Float32Array(decoded.buffer)); | ||
// Float32Array(6) [ 1, 2, 3, 4, 5, 6 ] | ||
``` |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
758289
21
18359
27
15
1
No