netlify / binary-info

Apache License 2.0
1 stars 2 forks source link

feat!: Return also architecture and platform #8

Closed danez closed 2 years ago

danez commented 2 years ago

Summary

This change will allow zisi to detect if a prebuilt binary is not built for the correct platform and provide a better warning to the user.

Diff of the public api / ts types

+export class BinaryInfo {
+  arch: number;
+  platform: number;
+  runtime?: number;
+}
+
-export function detect(data: Uint8Array): number | undefined;
+export function detect(data: Uint8Array): BinaryInfo;

BREAKING CHANGE: The result is now non-nullable and it is a struct with the fields architecture, platform, runtime. Runtime is nullable as we can only detect it for ELF binaries for now. If the architecture or platform cannot be detected it will throw.

Test plan

New tests were added. I'm also going to write integration tests in nodejs

Refs netlify/pillar-runtime#231 Fixes #5