How to use the TextDecoder function from util
Find comprehensive JavaScript util.TextDecoder code examples handpicked from public code repositorys.
23 24 25 26 27 28 29 30 31 32
```html <script src=".../path/to/HistoryTools.js"></script> <script> const encoder = new TextEncoder('utf8'); const decoder = new TextDecoder('utf8'); function prettyPrint(title, json) { console.log('\n' + title + '\n===================='); console.log(JSON.stringify(JSON.parse(json), null, 4));
57
37
14
+ 3 other calls in file
18 19 20 21 22 23 24 25 26 27
const { JavaClassFileReader } = require('java-class-tools'); const { TextDecoder } = require('util'); const reader = new JavaClassFileReader(); const classFile = reader.read('./Foo.class'); const textDecoder = new TextDecoder(); classFile.methods.forEach(md => { /** * Method name in constant-pool.
5
28
4
+ 3 other calls in file
GitHub: Countly/countly-server
8 9 10 11 12 13 14 15 16 17
// const std = {o: null, t: "df_OCowGSp-xLnbdqM1xLd:APA91bFZzdItrP2ia7jGk41Q0LxAev7p6lvq4NhFR0NKWw0_Az9yfjbGyKGggJ-22E650MYQEA8rPAKlDdcIjz5n5fwz8ap7mizWqnLhBV1qR3qyG_OkuKxRoOe7xB7OA-Eb-JLP4r0V", n: "5fbb9360b758", d: 1606129072150}; // const pers = {o: {'custom.data': 'Some string'}, t: "df_OCowGSp-xLnbdqM1xLd:APA91bFZzdItrP2ia7jGk41Q0LxAev7p6lvq4NhFR0NKWw0_Az9yfjbGyKGggJ-22E650MYQEA8rPAKlDdcIjz5n5fwz8ap7mizWqnLhBV1qR3qyG_OkuKxRoOe7xB7OA-Eb-JLP4r0V", n: "5fbb960b7358", d: 1606129072150}; // const data = Array.from(new Array(1000)).map(() => Math.random() > .3 ? std : pers); const {PushError} = require('./data/error'), enc = new TextEncoder(), dec = new TextDecoder(); const FRAME = { ERROR: 1 << 0, // 1, {error: string} in payload SUCCESS: 1 << 1, // 2 success for previous frame
954
0
228
22 23 24 25 26 27 28 29 30 31
}, }; const util = require("util"); global.TextEncoder = util.TextEncoder; global.TextDecoder = util.TextDecoder; } else { if (typeof window !== "undefined") { window.global = window; } else if (typeof self !== "undefined") {
0
6
0
GitHub: jsjtxietian/niagara
351 352 353 354 355 356 357 358 359 360 361 362
var util = require('util'); // Node versions before v12 don't support TextEncoder/TextDecoder natively, but util. provides compatible replacements if (typeof TextEncoder === 'undefined' && typeof TextDecoder === 'undefined') { TextEncoder = util.TextEncoder; TextDecoder = util.TextDecoder; } init(fs.readFileSync(__dirname + '/library.wasm')); }
0
0
0
util.promisify is the most popular function in util (378 examples)