Add function to append n bytes

This adds a function to add the first N bytes from a string into a buffer.
debugging left in :/ fixed in 430573b