Created
April 12, 2018 18:55
-
-
Save campoy/bea1e18a7b72a212bc0c5463bc2043d4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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