FuseJS/Base64 Module (JS)
Allows you to encode and decode strings from Base64.
This is useful when passing string to places where some characters are not allowed.
This example demonstrates simple use of the Base64
module. The code prints the input string, and the computed Base64 string.
var Base64 = require("FuseJS/Base64");
var string = "Hello, world!";
console.log(string); //LOG: Hello, world!
console.log(Base64.encodeAscii(string)); //LOG: SGVsbG8sIHdvcmxkIQ==
Location
- Namespace
- FuseJS
- Package
- FuseJS 2.9.1
Interface of Base64
decodeAscii(value) js
Decodes the given base64 value to an ASCII string representation
var Base64 = require("FuseJS/Base64");
console.log(Base64.decodeAscii("SGVsbG8sIHdvcmxkIQ==")); //LOG: Hello, world!
decodeBuffer(base64String) js
Decodes the given base64 string to an ArrayBuffer.
var Base64 = require("FuseJS/Base64");
var buf = Base64.decodeBuffer("NxMAAA==");
var view = new Int32Array(data);
// Should print 0x1337
console.log("0x" + view[0].toString(16));
decodeLatin1(stringToDecode) js
Decodes the given base64 Latin-1 encoded bytes to a string.
var Base64 = require("FuseJS/Base64");
// Prints "hello world"
console.log(Base64.decodeLatin1("aGVsbG8gd29ybGQ="));
decodeUtf8(value) js
Decodes the given base64 value to an UTF8 string representation
var Base64 = require("FuseJS/Base64");
console.log(Base64.encodeUtf8("Rm9vIMKpIGJhcg==")); //LOG: Foo © bar
encodeAscii(value) js
Encodes the given ASCII value to base64 string representation
var Base64 = require("FuseJS/Base64");
console.log(Base64.encodeAscii("Hello, world!")); //LOG: SGVsbG8sIHdvcmxkIQ==
encodeBuffer(arrayBuffer) js
Encodes given array buffer to base64.
var Base64 = require("FuseJS/Base64"); <a href="../fusejs/base64/encodebuffer_bbef95e2.html" class="table-of-contents-item-has-more" title="There is more information available for this entry"><i class="fa fa-ellipsis-h"></i></a>
encodeLatin1(stringToEncode) js
Encodes the given string to a Latin-1 base64 string.
var Base64 = require("FuseJS/Base64");
// Prints "aGVsbG8gd29ybGQ="
console.log(Base64.encodeLatin1("hello world"));
encodeUtf8(value) js
Encodes the given UTF8 value to a base64 string representation
var Base64 = require("FuseJS/Base64");
console.log(Base64.encodeUtf8("Foo © bar")); //LOG: Rm9vIMKpIGJhcg==
Inherited from NativeModule
AddMember(NativeMember) uno
Reset : EventHandler (object, EventArgs) ux
Inherited from Module
Dispose uno
Evaluate(Context, ModuleResult) uno
Evaluate(Context, string) : ModuleResult uno
Evaluated : EventHandler (object, EventArgs) ux
EvaluateExports(Context, string) : object uno
GetFile : FileSource uno
Returns the file source that will be watched by the Context for changes in Fuse preview. Override in subclasses and return correct file source to support live updates in Fuse preview.