Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Base64 encode and decode strings #378

Merged
merged 1 commit into from

2 participants

@jimeh

No description provided.

@tombell tombell merged commit 6785beb into github:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 15, 2012
  1. @jimeh

    Base64 encode and decode strings

    jimeh authored
This page is out of date. Refresh to see the latest.
Showing with 10 additions and 0 deletions.
  1. +10 −0 src/scripts/base64.coffee
View
10 src/scripts/base64.coffee
@@ -0,0 +1,10 @@
+# Base64 encoding and decoding.
+#
+# base64 encode|decode <query> - Base64 encode or decode <string>
+
+module.exports = (robot) ->
+ robot.respond /base64 encode( me)? (.*)/i, (msg) ->
+ msg.send new Buffer(msg.match[2]).toString('base64')
+
+ robot.respond /base64 decode( me)? (.*)/i, (msg) ->
+ msg.send new Buffer(msg.match[2], 'base64').toString('utf8')
Something went wrong with that request. Please try again.