File tree Expand file tree Collapse file tree 4 files changed +45
-20
lines changed
packages/local-mail-watcher Expand file tree Collapse file tree 4 files changed +45
-20
lines changed Original file line number Diff line number Diff line change 1- FROM node:22.12 as builder
1+ FROM node:22.12 as builder
22
33WORKDIR /app
44
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ /**
2+ * Utility functions for handling base64 encoding/decoding
3+ */
4+
5+ // Node.js Buffer is globally available
6+ // Only import type information - no runtime import
7+ // This will be removed during compilation
8+ import type { } from '../types/node-buffer' ;
9+
10+ /**
11+ * Decodes a base64 string to UTF-8 text
12+ * Uses Node.js Buffer with type safety
13+ */
14+ export function decodeBase64 ( base64String : string ) : string {
15+ try {
16+ return Buffer . from ( base64String , 'base64' ) . toString ( 'utf-8' ) ;
17+ } catch ( error ) {
18+ console . error ( 'Error decoding base64 string:' , error ) ;
19+ return base64String ; // Return original string if decoding fails
20+ }
21+ }
Original file line number Diff line number Diff line change 1+ declare global {
2+ interface Buffer extends Uint8Array {
3+ write ( string : string , encoding ?: BufferEncoding ) : number ;
4+ toString ( encoding ?: BufferEncoding , start ?: number , end ?: number ) : string ;
5+ }
6+
7+ interface BufferConstructor {
8+ from ( arrayBuffer : WithImplicitCoercion < ArrayBuffer | SharedArrayBuffer > , byteOffset ?: number , length ?: number ) : Buffer ;
9+ from ( data : WithImplicitCoercion < Uint8Array | readonly number [ ] > ) : Buffer ;
10+ from ( str : WithImplicitCoercion < string > , encoding ?: BufferEncoding ) : Buffer ;
11+ alloc ( size : number ) : Buffer ;
12+ alloc ( size : number , fill : string | Buffer | number ) : Buffer ;
13+ }
14+
15+ type WithImplicitCoercion < T > = T | { valueOf ( ) : T } ;
16+
17+ type BufferEncoding = 'ascii' | 'utf8' | 'utf-8' | 'utf16le' | 'ucs2' | 'ucs-2' | 'base64' | 'latin1' | 'binary' | 'hex' ;
18+
19+ const Buffer : BufferConstructor ;
20+ }
21+
22+ // This empty export makes TypeScript treat this file as a module
23+ export { } ;
You can’t perform that action at this time.
0 commit comments