Skip to content

Instantly share code, notes, and snippets.

@aristidb
Forked from kriskowal/gist:92762
Created April 9, 2009 21:52
Show Gist options
  • Save aristidb/92764 to your computer and use it in GitHub Desktop.
Save aristidb/92764 to your computer and use it in GitHub Desktop.
buffer = require('encoding').Converter('US-ASCII', 'US-ASCII')
buffer.put(magicallyMakeByteString('Hello,'))
buffer.put(magicallyMakeByteString(' '))
buffer.put(magicallyMakeByteString('World!'))
value = buffer.get()
assert(value == magicallyMakeByteString('Hello, World!'))
buffer = require('encoding').Converter('US-ASCII', 'US-ASCII')
buffer.put(value)
assert(buffer.get(7) == magicallyMakeByteString("Hello, "))
assert(buffer.get() == magicallyMakeByteString("World!"))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment