/* IMPORT */
import { Buffer } from 'node:buffer';
/* MAIN */
const BufferEncoding = {
    /* API */
    encode: (data, encoding) => {
        return Buffer.from(data).toString(encoding);
    },
    encodeStr: (data, encoding) => {
        return Buffer.from(data).toString(encoding);
    },
    decode: (data, encoding) => {
        const buffer = Buffer.from(data, encoding);
        return new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength);
    },
    decodeStr: (data, encoding) => {
        return Buffer.from(data, encoding).toString();
    }
};
/* EXPORT */
export default BufferEncoding;
