Skip to content

Instantly share code, notes, and snippets.

@campoy
Created Apr 12, 2018
Embed
What would you like to do?
package main
import (
"fmt"
"io/ioutil"
"log"
"os"
"strings"
)
func main() {
bs, err := ioutil.ReadAll(os.Stdin)
if err != nil {
log.Fatal(err)
}
b := new(strings.Builder)
fmt.Fprint(b, bs[0])
for _, c := range bs[1:] {
fmt.Fprintf(b, ", %d", c)
}
fmt.Printf("const bytes = new Uint8Array([%s]);", b)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment