How to use the text-encoding.TextEncoder function in text-encoding

To help you get started, we’ve selected a few text-encoding examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github killercup / wasm-experiments / src / type-converter.js View on Github external
arg(data, exports) {
      ensure(typeof data === "string", "Can only use `Uint8Array` as `&[u8]`");

      // @ts-ignore -- yes accessing these exports works
      const { alloc, memory } = exports;
      ensure(alloc, "You need to export an `alloc` function to get strings from WASM");
      ensure(memory, "You need to export the main memory to get strings from WASM");

      const utf8Encoder = new TextEncoder("UTF-8");
      const stringBuffer = utf8Encoder.encode(data);

      return newSlice(memory, alloc, stringBuffer);
    },
    /**
github popcodeorg / popcode / src / templates.js View on Github external
import base64 from 'base64-js';
import {TextEncoder} from 'text-encoding';
import spinnerPageHtml from '../templates/github-export.html';

export const spinnerPage = base64.fromByteArray(
  new TextEncoder('utf-8').encode(spinnerPageHtml),
);
github uber / xviz / modules / builder / src / writers / glb-writer / glb-encoder.js View on Github external
function convertObjectToJsonChunk(json) {
  const jsonChunkString = JSON.stringify(json);
  const textEncoder = new TextEncoder('utf8');
  return textEncoder.encode(jsonChunkString);
}
github IBM / ipfs-social-proof / src / utils.js View on Github external
function t2a (text) {
  return new TextEncoder("utf-8").encode(text)
}
github IBM / ipfs-social-proof / src / crypto.js View on Github external
function t2a (text) {
  return new TextEncoder("utf-8").encode(text)
}
github SocialXNetwork / socialx_react_native / packages / api-blockchain / src / api / index.ts View on Github external
const api = (rpcRef: typeof JsonRpc, signatureProvider: typeof JsSignatureProvider) =>
	new Api({
		rpc: rpcRef,
		signatureProvider,
		textDecoder: new TextDecoder(),
		textEncoder: new TextEncoder(),
	});
github eosdac / eosdac-api / fastify-eos.js View on Github external
module.exports = fp((fastify, options, next) => {
    const rpc = new JsonRpc(options.eos.endpoint, {fetch});
    const api = new Api({
        rpc,
        signatureProvider: null,
        chainId: options.chainId,
        textDecoder: new TextDecoder(),
        textEncoder: new TextEncoder(),
    });

    fastify.decorate('eos', {api, rpc});

    next();
}, {
    fastify: '>=1.0.0',
github eosdac / eosdac-api / eosdac-processor.js View on Github external
constructor() {
        this.config = loadConfig();

        const rpc = new JsonRpc(this.config.eos.endpoint, {fetch});
        this.api = new Api({
            rpc,
            signatureProvider: null,
            chainId: this.config.chainId,
            textDecoder: new TextDecoder(),
            textEncoder: new TextEncoder(),
        });

        this.logger = require('./connections/logger')('eosdac-processor', this.config.logger);
    }
github eosdac / eosdac-api / watchers / referendums.js View on Github external
constructor() {
        this.config = loadConfig();
        this.db = connectMongo(this.config);
        const rpc = new JsonRpc(this.config.eos.endpoint, {fetch});
        this.api = new Api({
            rpc,
            signatureProvider: null,
            chainId: this.config.chainId,
            textDecoder: new TextDecoder(),
            textEncoder: new TextEncoder(),
        });

        this.logger = require('../connections/logger')('watcher-proposals', this.config.logger);
    }

text-encoding

Polyfill for the Encoding Living Standard's API.

(Unlicense OR Apache-2.0)
Latest version published 6 years ago

Package Health Score

56 / 100
Full package analysis