How to use the iconv-lite.getCodec function in iconv-lite

To help you get started, we’ve selected a few iconv-lite 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 mongaku / mongaku / tests / init.js View on Github external
const fs = require("fs");
const path = require("path");

const tap = require("tap");
const sinon = require("sinon");
const mockfs = require("mock-fs");
const async = require("async");
const iconv = require("iconv-lite");

// Force ICONV to pre-load its encodings
iconv.getCodec("utf8");

// Force babel sub-modules to preload
require("babel-preset-react");
require("babel-helper-builder-react-jsx");
require("babel-plugin-flow-react-proptypes");
require("../lib/babel");

// Load in global ENV
process.env.BASE_DATA_DIR = path.resolve(process.cwd(), "data");

const record = require("../lib/record");
const models = require("../lib/models");
const options = require("../lib/options");
const similarity = require("../lib/similar");
const server = require("../server/server");
github jeresig / pharos-images / tests / init.js View on Github external
process.env.BASE_DATA_DIR = process.cwd();
process.env.PASTEC_URL = "localhost:4212";
process.env.ELASTICSEARCH_URL = "http://localhost:9200";

const fs = require("fs");
const path = require("path");

const tap = require("tap");
const sinon = require("sinon");
const mockfs = require("mock-fs");
const async = require("async");
const iconv = require("iconv-lite");

// Force ICONV to pre-load its encodings
iconv.getCodec("utf8");

// Force babel sub-modules to preload
require("babel-preset-react");
require("babel-helper-builder-react-jsx");
require("babel-register");

const models = require("../lib/models");
const similarity = require("../lib/similar");
const server = require("../server/server");

// Models used for testing
const Image = models("Image");
const Artwork = models("Artwork");
const Source = models("Source");
const ImageImport = models("ImageImport");
const ArtworkImport = models("ArtworkImport");
github ehmicky / autoserver / src / charsets / main.js View on Github external
import iconv from 'iconv-lite'
import filterObj from 'filter-obj'

import { validateCharset } from './validate.js'
import { decodeCharset } from './transform.js'

// `iconv.encodings` is lazily set, i.e. we need to do this noop
iconv.getCodec('binary')

const { encodings } = iconv

// Normalize charset, including adding defaults and validating
export const getCharset = function(charset, { format } = {}) {
  const charsetA = addDefaultCharset({ charset, format })

  const charsetB = charsetA.toLowerCase()

  validateCharset({ charset: charsetB, format })

  const charsetC = createInstance({ charset: charsetB, title: charsetA })

  return charsetC
}
github sfbrigade / San-Francisco-in-Progress / node_modules / body-parser / node_modules / raw-body / index.js View on Github external
function getDecoder(encoding) {
  if (!encoding) return null

  try {
    return iconv.getCodec(encoding).decoder()
  } catch (e) {
    var err = makeError('specified encoding unsupported', 'encoding.unsupported')
    err.status = err.statusCode = 415
    err.encoding = encoding
    throw err
  }
}
github useringo / ringo / build-server / node_modules / body-parser / node_modules / raw-body / index.js View on Github external
function getDecoder(encoding) {
  if (!encoding) return null

  try {
    return iconv.getCodec(encoding).decoder()
  } catch (e) {
    var err = makeError('specified encoding unsupported', 'encoding.unsupported')
    err.status = err.statusCode = 415
    err.encoding = encoding
    throw err
  }
}