Files
DefinitelyTyped/types/urlsafe-base64/index.d.ts
2017-03-24 14:27:52 -07:00

50 lines
1.0 KiB
TypeScript

// Type definitions for urlsafe-base64 v1.0.0
// Project: https://github.com/RGBboy/urlsafe-base64
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node"/>
/**
* Library version.
*/
export declare var version: string;
/**
* .encode
*
* return an encoded Buffer as URL Safe Base64
*
* Note: This function encodes to the RFC 4648 Spec where '+' is encoded
* as '-' and '/' is encoded as '_'. The padding character '=' is
* removed.
*
* @param {Buffer} buffer
* @return {String}
* @api public
*/
export declare function encode(buffer: Buffer): string;
/**
* .decode
*
* return an decoded URL Safe Base64 as Buffer
*
* @param {String}
* @return {Buffer}
* @api public
*/
export declare function decode(base64: string): Buffer;
/**
* .validate
*
* Validates a string if it is URL Safe Base64 encoded.
*
* @param {String}
* @return {Boolean}
* @api public
*/
export declare function validate(base64: string): boolean;