open-collaboration-protocol
Version:
Open Collaboration Protocol implementation, part of the Open Collaboration Tools project
23 lines • 797 B
JavaScript
// ******************************************************************************
// Copyright 2024 TypeFox GmbH
// This program and the accompanying materials are made available under the
// terms of the MIT License, which is available in the project root.
// ******************************************************************************
import { fromByteArray, toByteArray } from 'base64-js';
export function fromBase64(data) {
if (typeof Buffer === 'undefined') {
return toByteArray(data);
}
else {
return Buffer.from(data, 'base64');
}
}
export function toBase64(data) {
if (typeof Buffer === 'undefined') {
return fromByteArray(data);
}
else {
return Buffer.from(data).toString('base64');
}
}
//# sourceMappingURL=base64.js.map