0.1.2 • Published 2 years ago

@stitch-it/convert v0.1.2

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
2 years ago

An utility library for Stitch It runtime that provides bunch of conversion functions.

Usage

Either import individual functions:

import { convertTextToBase64 } from '@stitch-it/convert';

export default async function(event: any, context: Context): Promise<void> {
	console.log(convertTextToBase64('HELLO WORLD', 'utf8'));
}

or import the entire namespace:

import { Convert } from '@stitch-it/convert';

export default async function(event: any, context: Context): Promise<void> {
	console.log(Convert.textToBase64('HELLO WORLD', 'utf8'));
}

Available functions

convertBase64ToBuffer(base64: string): UInt8Array;
convertBase64ToText(base64: string, encoding?: string = 'utf8'): string;
convertBufferToBase64(buffer: ArrayBuffer): string;
convertBufferToText(buffer: ArrayBuffer, encoding?: string = 'utf8'): string;
convertTextToBase64(text: string, encoding?: string = 'utf8'): string;
convertTextToBuffer(text: string, encoding?: string = 'utf8'): UInt8Array;
convertTextToText(text: string, sourceEncoding: string, targetEncoding?: string = 'utf8');
0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago