python-struct
Advanced tools
Comparing version 1.0.8 to 1.1.0
{ | ||
"name": "python-struct", | ||
"version": "1.0.8", | ||
"version": "1.1.0", | ||
"description": "Packs/Unpacks/Measures structs according to Python's `struct` format", | ||
"main": "index.js", | ||
"main": "src/node_adapter.js", | ||
"browser": "src/browser_adapter.js", | ||
"scripts": { | ||
"lint": "eslint ./", | ||
"lint-fix": "eslint --fix ./", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
@@ -27,4 +30,6 @@ }, | ||
"dependencies": { | ||
"eslint": "^6.2.2", | ||
"husky": "^3.0.4", | ||
"long": "^4.0.0" | ||
} | ||
} |
@@ -19,16 +19,21 @@ # python-struct | ||
struct.sizeOf('>iixxQ10sb') // --> 34 | ||
struct.sizeOf('>iixxQ10sb'); // --> 29 | ||
struct.pack('>iixxQ10sb', [1234, 5678, require('long').fromString('12345678901234567890'), 'abcdefg', true]); // --> <Buffer 00 00 04 d2 00 00 16 2e ab 54 a9 8c eb 1f 0a d2 61 62 63 64 65 66 67 00 00 00 00 00 00 00 00 00 18 80 01> | ||
struct.pack('>iixxQ10sb', [1234, 5678, require('long').fromString('12345678901234567890'), 'abcdefg', true]); // --> <Buffer 00 00 04 d2 00 00 16 2e 00 00 ab 54 a9 8c eb 1f 0a d2 61 62 63 64 65 66 67 00 00 00 01> | ||
struct.unpack('>iixxQ10sb', Buffer.from('000004d20000162eab54a98ceb1f0ad2616263646566670000000000000000001880', 'hex')); // --> [ 1234, 5678, 12345678901234567890, 'abcdefg', true ] | ||
struct.unpack('>iixxQ10sb', Buffer.from('000004d20000162e0000ab54a98ceb1f0ad26162636465666700000001', 'hex')); // --> [ 1234, 5678, 12345678901234567890, 'abcdefg', 1 ] | ||
``` | ||
## Usage in the browser | ||
The `"browser"` entry in `package.json` will automatically redirect to the browser adapter for the package. | ||
*But* you'll have to `npm i buffer` in your project. | ||
## Notes | ||
When using "native" size & alignment, we do not really have a way to find the native size of alignment of types. | ||
But it's almost always safe to assume that `node.js` is compiled for the standard architectures, so `native` behaves like `standard`. | ||
But it's almost always safe to assume that `node_adapter.js` is compiled for the standard architectures, so `native` behaves like `standard`. | ||
If anyone stumbles accross a different case, I'll be happy to review it on that specific instance, and figure out what to do. | ||
If anyone stumbles across a different case, I'll be happy to review it on that specific instance, and figure out what to do. | ||
@@ -35,0 +40,0 @@ ## Contributing |
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
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
34772
11
653
73
3
2
+ Addedeslint@^6.2.2
+ Addedhusky@^3.0.4
+ Added@babel/code-frame@7.26.2(transitive)
+ Added@babel/helper-validator-identifier@7.25.9(transitive)
+ Added@types/normalize-package-data@2.4.4(transitive)
+ Addedacorn@7.4.1(transitive)
+ Addedacorn-jsx@5.3.2(transitive)
+ Addedajv@6.12.6(transitive)
+ Addedansi-escapes@4.3.2(transitive)
+ Addedansi-regex@4.1.15.0.1(transitive)
+ Addedansi-styles@3.2.14.3.0(transitive)
+ Addedargparse@1.0.10(transitive)
+ Addedastral-regex@1.0.0(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedcaller-callsite@2.0.0(transitive)
+ Addedcaller-path@2.0.0(transitive)
+ Addedcallsites@2.0.03.1.0(transitive)
+ Addedchalk@2.4.24.1.2(transitive)
+ Addedchardet@0.7.0(transitive)
+ Addedci-info@2.0.0(transitive)
+ Addedcli-cursor@3.1.0(transitive)
+ Addedcli-width@3.0.0(transitive)
+ Addedcolor-convert@1.9.32.0.1(transitive)
+ Addedcolor-name@1.1.31.1.4(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedcosmiconfig@5.2.1(transitive)
+ Addedcross-spawn@6.0.6(transitive)
+ Addeddebug@4.4.0(transitive)
+ Addeddeep-is@0.1.4(transitive)
+ Addeddoctrine@3.0.0(transitive)
+ Addedemoji-regex@7.0.38.0.0(transitive)
+ Addedend-of-stream@1.4.4(transitive)
+ Addederror-ex@1.3.2(transitive)
+ Addedescape-string-regexp@1.0.5(transitive)
+ Addedeslint@6.8.0(transitive)
+ Addedeslint-scope@5.1.1(transitive)
+ Addedeslint-utils@1.4.3(transitive)
+ Addedeslint-visitor-keys@1.3.0(transitive)
+ Addedespree@6.2.1(transitive)
+ Addedesprima@4.0.1(transitive)
+ Addedesquery@1.6.0(transitive)
+ Addedesrecurse@4.3.0(transitive)
+ Addedestraverse@4.3.05.3.0(transitive)
+ Addedesutils@2.0.3(transitive)
+ Addedexeca@1.0.0(transitive)
+ Addedexternal-editor@3.1.0(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
+ Addedfast-json-stable-stringify@2.1.0(transitive)
+ Addedfast-levenshtein@2.0.6(transitive)
+ Addedfigures@3.2.0(transitive)
+ Addedfile-entry-cache@5.0.1(transitive)
+ Addedfind-up@4.1.0(transitive)
+ Addedflat-cache@2.0.1(transitive)
+ Addedflatted@2.0.2(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedfunctional-red-black-tree@1.0.1(transitive)
+ Addedget-stdin@7.0.0(transitive)
+ Addedget-stream@4.1.0(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedglob-parent@5.1.2(transitive)
+ Addedglobals@12.4.0(transitive)
+ Addedhas-flag@3.0.04.0.0(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedhosted-git-info@2.8.9(transitive)
+ Addedhusky@3.1.0(transitive)
+ Addediconv-lite@0.4.24(transitive)
+ Addedignore@4.0.6(transitive)
+ Addedimport-fresh@2.0.03.3.0(transitive)
+ Addedimurmurhash@0.1.4(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedinquirer@7.3.3(transitive)
+ Addedis-arrayish@0.2.1(transitive)
+ Addedis-core-module@2.16.1(transitive)
+ Addedis-directory@0.3.1(transitive)
+ Addedis-extglob@2.1.1(transitive)
+ Addedis-fullwidth-code-point@2.0.03.0.0(transitive)
+ Addedis-glob@4.0.3(transitive)
+ Addedis-stream@1.1.0(transitive)
+ Addedisexe@2.0.0(transitive)
+ Addedjs-tokens@4.0.0(transitive)
+ Addedjs-yaml@3.14.1(transitive)
+ Addedjson-parse-better-errors@1.0.2(transitive)
+ Addedjson-parse-even-better-errors@2.3.1(transitive)
+ Addedjson-schema-traverse@0.4.1(transitive)
+ Addedjson-stable-stringify-without-jsonify@1.0.1(transitive)
+ Addedlevn@0.3.0(transitive)
+ Addedlines-and-columns@1.2.4(transitive)
+ Addedlocate-path@5.0.0(transitive)
+ Addedlodash@4.17.21(transitive)
+ Addedmimic-fn@2.1.0(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedmkdirp@0.5.6(transitive)
+ Addedms@2.1.3(transitive)
+ Addedmute-stream@0.0.8(transitive)
+ Addednatural-compare@1.4.0(transitive)
+ Addednice-try@1.0.5(transitive)
+ Addednormalize-package-data@2.5.0(transitive)
+ Addednpm-run-path@2.0.2(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedonetime@5.1.2(transitive)
+ Addedopencollective-postinstall@2.0.3(transitive)
+ Addedoptionator@0.8.3(transitive)
+ Addedos-tmpdir@1.0.2(transitive)
+ Addedp-finally@1.0.0(transitive)
+ Addedp-limit@2.3.0(transitive)
+ Addedp-locate@4.1.0(transitive)
+ Addedp-try@2.2.0(transitive)
+ Addedparent-module@1.0.1(transitive)
+ Addedparse-json@4.0.05.2.0(transitive)
+ Addedpath-exists@4.0.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedpath-key@2.0.1(transitive)
+ Addedpath-parse@1.0.7(transitive)
+ Addedpicocolors@1.1.1(transitive)
+ Addedpkg-dir@4.2.0(transitive)
+ Addedplease-upgrade-node@3.2.0(transitive)
+ Addedprelude-ls@1.1.2(transitive)
+ Addedprogress@2.0.3(transitive)
+ Addedpump@3.0.2(transitive)
+ Addedpunycode@2.3.1(transitive)
+ Addedread-pkg@5.2.0(transitive)
+ Addedregexpp@2.0.1(transitive)
+ Addedresolve@1.22.10(transitive)
+ Addedresolve-from@3.0.04.0.0(transitive)
+ Addedrestore-cursor@3.1.0(transitive)
+ Addedrimraf@2.6.3(transitive)
+ Addedrun-async@2.4.1(transitive)
+ Addedrun-node@1.0.0(transitive)
+ Addedrxjs@6.6.7(transitive)
+ Addedsafer-buffer@2.1.2(transitive)
+ Addedsemver@5.7.26.3.1(transitive)
+ Addedsemver-compare@1.0.0(transitive)
+ Addedshebang-command@1.2.0(transitive)
+ Addedshebang-regex@1.0.0(transitive)
+ Addedsignal-exit@3.0.7(transitive)
+ Addedslash@3.0.0(transitive)
+ Addedslice-ansi@2.1.0(transitive)
+ Addedspdx-correct@3.2.0(transitive)
+ Addedspdx-exceptions@2.5.0(transitive)
+ Addedspdx-expression-parse@3.0.1(transitive)
+ Addedspdx-license-ids@3.0.21(transitive)
+ Addedsprintf-js@1.0.3(transitive)
+ Addedstring-width@3.1.04.2.3(transitive)
+ Addedstrip-ansi@5.2.06.0.1(transitive)
+ Addedstrip-eof@1.0.0(transitive)
+ Addedstrip-json-comments@3.1.1(transitive)
+ Addedsupports-color@5.5.07.2.0(transitive)
+ Addedsupports-preserve-symlinks-flag@1.0.0(transitive)
+ Addedtable@5.4.6(transitive)
+ Addedtext-table@0.2.0(transitive)
+ Addedthrough@2.3.8(transitive)
+ Addedtmp@0.0.33(transitive)
+ Addedtslib@1.14.1(transitive)
+ Addedtype-check@0.3.2(transitive)
+ Addedtype-fest@0.21.30.6.00.8.1(transitive)
+ Addeduri-js@4.4.1(transitive)
+ Addedv8-compile-cache@2.4.0(transitive)
+ Addedvalidate-npm-package-license@3.0.4(transitive)
+ Addedwhich@1.3.1(transitive)
+ Addedword-wrap@1.2.5(transitive)
+ Addedwrappy@1.0.2(transitive)
+ Addedwrite@1.0.3(transitive)