Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

python-struct

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

python-struct - npm Package Compare versions

Comparing version 1.0.8 to 1.1.0

.DS_Store

9

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc