Detalhes do pacote

@netlify/binary-info

netlify1.9mApache 21.0.0

binary-info is a WebAssembly(WASM) module to extract very specific information from binary files.

readme (leia-me)

Introduction

@netlify/binary-info is a WebAssembly(WASM) module to extract very specific information from binary files.

It's used by other Netlify projects to detect Go and Rust binaries built for Netlify Functions and its architecture and platform .

Usage

import { readFile } = require("fs");
import { detect, Runtime }from "@netlify/binary-info";

const buffer = await readFile(path);
try {
  const info = elf.detect(buffer);
  switch (info.runtime) {
    case Runtime.Go: console.log("Go binary file"); break;
    case Runtime.Rust: console.log("Rust binary file"); break;
    default: console.log("Unknown binary file");
  }
} catch (error) {
  console.log(error);
}

Development

🛠️ Build with wasm-pack build

wasm-pack build --target nodejs --release --scope=netlify

changelog (log de mudanças)

Changelog

1.0.0 (2022-06-23)

⚠ BREAKING CHANGES

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

Features

  • Rename package to binary-info and fix release (#15) (0d59e30)
  • Return also architecture and platform (#8) (6aa4a95)

Miscellaneous Chores