Skip to content
Browse files

Initial commit;

  • Loading branch information...
0 parents commit bf9607a942ed499e8312aa138bea879fba86c865 RGBboy committed Feb 20, 2013
Showing with 126 additions and 0 deletions.
  1. +3 −0 .gitignore
  2. +6 −0 .npmignore
  3. +7 −0 .travis.yml
  4. +13 −0 Makefile
  5. +26 −0 package.json
  6. +71 −0 readme.md
3 .gitignore
@@ -0,0 +1,3 @@
+.DS_Store
+node_modules/
+*.tmproj
6 .npmignore
@@ -0,0 +1,6 @@
+.DS_Store
+.git*
+.travis*
+Makefile
+test/
+*.tmproj
7 .travis.yml
@@ -0,0 +1,7 @@
+language: node_js
+node_js:
+ - 0.8
+services:
+ - mongodb
+before_script:
+ - mongo basic-user-schema-test --eval 'db.addUser("basic-user-schema-test", "basic-user-schema-test");'
13 Makefile
@@ -0,0 +1,13 @@
+UNITS = $(shell find test -name "*.test.js")
+SPECS = $(shell find test -name "*.spec.js")
+
+unit:
+ NODE_ENV=test ./node_modules/.bin/mocha $(UNITS)
+
+spec:
+ NODE_ENV=test ./node_modules/.bin/mocha $(SPECS)
+
+test:
+ NODE_ENV=test ./node_modules/.bin/mocha $(UNITS) $(SPECS)
+
+.PHONY: test unit spec
26 package.json
@@ -0,0 +1,26 @@
+{
+ "name": "urlsafe-base64",
+ "version": "0.0.1",
+ "description": "URL Safe Base64 encoding",
+ "keywords": ["base64", "encoding", "url", "util"],
+ "author": "RGBboy <me@rgbboy.com>",
+ "repository" : {
+ "type" : "git",
+ "url" : "http://github.com/RGBboy/urlsafe-base64"
+ },
+ "main": "index",
+ "engines": {
+ "node": "0.8.x"
+ },
+ "dependencies": {
+ },
+ "devDependencies": {
+ "mocha": "1.5.x",
+ "should": "1.2.x"
+ },
+ "scripts" : {
+ "test" : "make test",
+ "unit" : "make unit",
+ "spec" : "make spec"
+ }
+}
71 readme.md
@@ -0,0 +1,71 @@
+# URL Safe Base64
+
+URL Safe Base64 util module for Node.js applications
+
+[![Build Status](https://secure.travis-ci.org/RGBboy/urlsafe-base64.png)](http://travis-ci.org/RGBboy/urlsafe-base64)
+
+## Installation
+
+ npm install urlsafe-base64
+
+## Usage
+
+Require it within your module:
+
+``` javascript
+ var URLSafeBase64 = require('urlsafe-base64');
+```
+
+### .encode(buffer)
+
+Encodes a buffer as a URL Safe Base64 string. This function encodes to
+the RFC 4648 Spec where '+' is encoded as '-' and '/' is encoded as '_'.
+The padding character '=' is removed.
+
+``` javascript
+ var randomURLSafeBase64;
+ crypto.randomBytes(32, function(err, buf) {
+ if (err) {
+ throw err;
+ return;
+ };
+ randomURLSafeBase64 = URLSafeBase64.encode(buf);
+ });
+```
+
+### .validate(string)
+
+Validates a string if it is URL Safe Base64 encoded.
+
+``` javascript
+ var validURLSafeBase64 = '';
+ URLSafeBase64.validate(validURLSafeBase64); // returns true
+
+ var invalidURLSafeBase64 = '/+=='
+ URLSafeBase64.validate(invalidURLSafeBase64); // returns false
+```
+
+## License
+
+(The MIT License)
+
+Copyright (c) 2013 RGBboy &lt;me@rgbboy.com&gt;
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+'Software'), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0 comments on commit bf9607a

Please sign in to comment.
Something went wrong with that request. Please try again.