Skip to content

Commit

Permalink
feat: Added base64 function
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardmessias committed Aug 28, 2021
1 parent fc0cc7a commit 40e7b25
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/whatsapp/misc/Base64.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
/*!
* Copyright 2021 WPPConnect Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import { exportModule } from '../exportModule';

/**
* @moduleID 45792
* @whatsapp 2.2132.6
*/
export declare const Base64: {
BASE64_DATA_URL_SCHEME: 'data:image/jpeg;base64,';
encodeB64(data: ArrayLike<number> | ArrayBufferLike): string;
encodeB64UrlSafe(
data: ArrayLike<number> | ArrayBufferLike,
t?: boolean
): string;
decodeB64(data: string): ArrayBufferLike;
decodeB64UrlSafe(data: string): ArrayBufferLike;
decodeB64ToJsArray(data: string): number[];
sizeWhenB64Decoded(data: ArrayLike<number> | ArrayBufferLike): number;
};

exportModule(exports, 'Base64', (m) => m.encodeB64 && m.decodeB64);
1 change: 1 addition & 0 deletions src/whatsapp/misc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

export * from './Base64';
export * from './Browser';
export * from './ClockSkew';
export * from './Conn';
Expand Down

0 comments on commit 40e7b25

Please sign in to comment.