https://github.com/netlify/binary-info
https://github.com/netlify/binary-info
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/netlify/binary-info
- Owner: netlify
- License: apache-2.0
- Created: 2020-10-20T18:24:59.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-05-27T22:47:12.000Z (about 2 years ago)
- Last Synced: 2025-04-19T06:01:57.944Z (2 months ago)
- Language: Rust
- Homepage:
- Size: 5.74 MB
- Stars: 1
- Watchers: 8
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE_APACHE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
## 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
```js
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
```