From cf63277fc064c4b566fa27869dadb3540a04f756 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Fri, 10 Nov 2023 18:40:01 +0000 Subject: [PATCH] file: recognize wasm binary modules. --- toys/posix/file.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/toys/posix/file.c b/toys/posix/file.c index cada80e1..1fdbefde 100644 --- a/toys/posix/file.c +++ b/toys/posix/file.c @@ -445,6 +445,10 @@ static void do_regular_file(int fd, char *name) } else if (len>4 && !smemcmp(s, "ABX", 3)) { xprintf("Android Binary XML v%d\n", s[3]); + // https://webassembly.github.io/spec/core/binary/modules.html#binary-module + } else if (len>8 && !smemcmp(s, "\0asm", 4)) { + xprintf("wasm binary module version %d\n", (int)peek_le(s+4, 4)); + // Text files, including shell scripts. } else { char *what = 0; -- 2.39.2