@netlify/binary-info
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i @netlify/binary-info

Weekly Downloads

119,723

Version

1.0.0

License

Apache 2

Unpacked Size

233 kB

Total Files

6

Last publish

Collaborators

  • claireknight
  • youvalv
  • berdav
  • vitaliyr
  • smnh
  • denar90
  • kathmbeck
  • rj-netlify
  • akardet
  • pieh
  • hrishikeshk
  • sarahetter
  • orinokai
  • seanroberts
  • mikewen
  • biilmann
  • marcus.netlify
  • jgantunes
  • eduardoboucas
  • netlify-bot
  • nasiba