1.1.3 • Published 6 years ago

google-big-query-labels v1.1.3

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

google-big-query-labels

A library to encode strings so that they can be written as label metadata on google big query entries. These labels are have a number of rules which restrict their usage, and this package ensure that the encoded string conforms to those rules. This library is useful for encoding Id's.

API

Re-encoding strings specifying their original alphabets.

const {encode, decode} = require('google-big-query-labels');
const stringToEncode = 'helloworld1';
const base36Alphabet = '0123456789abcdefghijklmnopqrstuvwxyz';
const encoded = encode(stringToEncode, base36Alphabet); // 'l834pvjszr_n'
decode(encoded, base36Alphabet) // 'helloworld1'

Utility function to re-encode strings which are encoded in the base 64 url alphabet.

const {encodeBase64Url, decodeBase64Url} = require('google-big-query-labels');
const base64UrlEncoded = 'c29tZWJhc2U2NGVuY29kZWQ';
const encoded = encodeBase64Url(base64UrlEncoded); // 'l-a9qk8gqih_dsohfdkul2gafsz0'
decodeBase64Url(encoded) // 'c29tZWJhc2U2NGVuY29kZWQ'
1.1.3

6 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago