<commit_before># `cs-wasm`

[![Build status](https://travis-ci.org/jonathanvdc/cs-wasm.svg?branch=master)](https://travis-ci.org/jonathanvdc/cs-wasm)
[![Build status](https://ci.appveyor.com/api/projects/status/4lfpgydcssxvr56o?svg=true)](https://ci.appveyor.com/project/jonathanvdc/cs-wasm)
[![NuGet](https://img.shields.io/nuget/v/Wasm.svg)]()

`cs-wasm` is a C# library that can read and write binary WebAssembly files. It tries to represent WebAssembly files as faithfully as possible; reading a file into memory and writing it back to disk is byte-for-byte equivalent to a simple copy.

## Setting up `cs-wasm`

Installing `cs-wasm` is easy. Just add a dependency on the [**Wasm** NuGet package](https://www.nuget.org/packages/Wasm) and you'll be all set.

## Using `cs-wasm`

Here are some sample code fragments to give you a feel of what it's like to use `cs-wasm`.

### Reading a WebAssembly file

Reading binary WebAssembly files is pretty easy. All we have to do is call a `WasmFile.ReadBinaryFrom` overload, like so:

```cs
using Wasm;
// ...
WasmFile file = WasmFile.ReadBinaryFrom(path);
// - or -
file = WasmFile.ReadBinaryFrom(stream);
```

### Writing a `WasmFile` to disk

Given a `WasmFile` stored in a variable `file`, we can just:

```cs<commit_msg>Fix broken link to NuGet package in README<commit_after># `cs-wasm`

[![Build status](https://travis-ci.org/jonathanvdc/cs-wasm.svg?branch=master)](https://travis-ci.org/jonathanvdc/cs-wasm)
[![Build status](https://ci.appveyor.com/api/projects/status/4lfpgydcssxvr56o?svg=true)](https://ci.appveyor.com/project/jonathanvdc/cs-wasm)
[![NuGet](https://img.shields.io/nuget/v/Wasm.svg)](https://www.nuget.org/packages/Wasm)

`cs-wasm` is a C# library that can read and write binary WebAssembly files. It tries to represent WebAssembly files as faithfully as possible; reading a file into memory and writing it back to disk is byte-for-byte equivalent to a simple copy.

## Setting up `cs-wasm`

Installing `cs-wasm` is easy. Just add a dependency on the [**Wasm** NuGet package](https://www.nuget.org/packages/Wasm) and you'll be all set.

## Using `cs-wasm`

Here are some sample code fragments to give you a feel of what it's like to use `cs-wasm`.

### Reading a WebAssembly file

Reading binary WebAssembly files is pretty easy. All we have to do is call a `WasmFile.ReadBinaryFrom` overload, like so:

```cs
using Wasm;
// ...
WasmFile file = WasmFile.ReadBinaryFrom(path);
// - or -
file = WasmFile.ReadBinaryFrom(stream);
```

### Writing a `WasmFile` to disk

Given a `WasmFile` stored in a variable `file`, we can just:

```cs
{'fraction_non_alphanumeric': 0.1379707916986933, 'fraction_numerical': 0.0023059185242121443, 'mean_word_length': 4.445606694560669, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 13, 'lorem ipsum': 0, 'www.': 3, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '153848', 'n_tokens_mistral': 912, 'n_tokens_neox': 884, 'n_words': 282}