numpy-parser
Advanced tools
Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "numpy-parser", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "A JS parser for binary .npy files.", | ||
@@ -11,3 +11,3 @@ "main": "src/main.js", | ||
"type": "git", | ||
"url": "git+https://github.com/distillpub/numpy-parser.git" | ||
"url": "git+https://github.com/ludwigschubert/js-numpy-parser.git" | ||
}, | ||
@@ -18,18 +18,13 @@ "keywords": [ | ||
"npy", | ||
"parser", | ||
"reader", | ||
"loader" | ||
"parser" | ||
], | ||
"author": "Ludwig Schubert", | ||
"license": "UNLICENSED", | ||
"license": "Apache-2.0", | ||
"bugs": { | ||
"url": "https://github.com/distillpub/numpy-parser/issues" | ||
"url": "https://github.com/ludwigschubert/js-numpy-parser/issues" | ||
}, | ||
"homepage": "https://github.com/distillpub/numpy-parser#readme", | ||
"homepage": "https://github.com/ludwigschubert/js-numpy-parser#readme", | ||
"devDependencies": { | ||
"mocha": "^3.4.2" | ||
}, | ||
"dependencies": { | ||
"filereader": "^0.10.3" | ||
"mocha": "^5.2.0" | ||
} | ||
} |
# numpy-parser | ||
A JS parser for binary .npy files. | ||
A JS parser for (binary) `.npy` files, supporting all TypedArray subclasses: | ||
Only supports UInt, Int and Floats at the moment. | ||
* float32 & float64 | ||
* int8, int16, int32 | ||
* uint8, uint16, uint32 | ||
This is a loosely cleaned up version of a gist by nvictus: | ||
https://gist.github.com/nvictus/88b3b5bfe587d32ac1ab519fd0009607 | ||
## Acknowledgements | ||
This implementation was inspired by [this gist by nvictus](https://gist.github.com/nvictus/88b3b5bfe587d32ac1ab519fd0009607). | ||
## Future Work | ||
`.npy` files can encode floats as 16 bit long, too. While JS runtimes may not support this as a native data type, we could still consider supporting it and parsing into 32 bit floats to at least get the bandwidth savings in transit. |
@@ -1,2 +0,1 @@ | ||
function asciiDecode(buffer) { | ||
@@ -16,2 +15,3 @@ const castBuffer = new Uint8Array(buffer); | ||
switch (dtype) { | ||
// Unsigned Integer | ||
@@ -21,5 +21,6 @@ case '|u1': | ||
case '<u2': | ||
return new UInt16Array(buffer, offset); | ||
return new Uint16Array(buffer, offset); | ||
case '<u4': | ||
return new UInt32Array(buffer, offset); | ||
return new Uint32Array(buffer, offset); | ||
// Integer | ||
@@ -29,5 +30,6 @@ case '|i1': | ||
case '<i2': | ||
return new Int16rray(buffer, offset); | ||
return new Int16Array(buffer, offset); | ||
case '<i4': | ||
return new Int32Array(buffer, offset); | ||
// Floating Point | ||
@@ -63,3 +65,2 @@ case '<f4': | ||
if (header.fortran_order) { | ||
// TODO: figure out if/how to handle this | ||
throw new Error('file is in Fortran byte order; giving up') | ||
@@ -66,0 +67,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 40 instances in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Explicitly Unlicensed Item
License(Experimental) Something was found which is explicitly marked as unlicensed.
Found 1 instance in 1 package
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No License Found
License(Experimental) License information could not be found.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
25994
0
48
0
0
0
100
116
1
0
15
40
- Removedfilereader@^0.10.3
- Removedfilereader@0.10.3(transitive)