{
  "_id": "charset",
  "maintainers": [
    {
      "name": "fengmk2",
      "email": "fengmk2@gmail.com"
    }
  ],
  "keywords": [
    "charset",
    "content-type",
    "ContentType",
    "Content-Type",
    "xml",
    "encoding"
  ],
  "dist-tags": {
    "latest": "1.0.1"
  },
  "author": {
    "name": "fengmk2",
    "email": "fengmk2@gmail.com",
    "url": "https://fengmk2.com"
  },
  "_rev": "17-0f5ad058324fe552740c8881ec44f478",
  "description": "Get the content charset from header and html content-type.",
  "readme": "charset\n=======\n\n[![NPM version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![Test coverage][codecov-image]][codecov-url]\n[![David deps][david-image]][david-url]\n[![npm download][download-image]][download-url]\n\n[npm-image]: https://img.shields.io/npm/v/charset.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/charset\n[travis-image]: https://img.shields.io/travis/node-modules/charset.svg?style=flat-square\n[travis-url]: https://travis-ci.org/node-modules/charset\n[codecov-image]: https://codecov.io/gh/node-modules/charset/branch/master/graph/badge.svg\n[codecov-url]: https://codecov.io/gh/node-modules/charset\n[david-image]: https://img.shields.io/david/node-modules/charset.svg?style=flat-square\n[david-url]: https://david-dm.org/node-modules/charset\n[download-image]: https://img.shields.io/npm/dm/charset.svg?style=flat-square\n[download-url]: https://npmjs.org/package/charset\n\n![logo](https://raw.github.com/node-modules/charset/master/logo.png)\n\nGet the content charset from header and html content-type.\n\n## Install\n\n```bash\n$ npm install charset --save\n```\n\n## Usage\n\n### Detect charset from http client response and content\n\n```js\nvar charset = require('charset');\nvar http = require('http');\n\nhttp.get('http://nodejs.org', function (res) {\n  res.on('data', function (chunk) {\n    console.log(charset(res.headers, chunk));\n    // or `console.log(charset(res, chunk));`\n    res.destroy();\n  });\n});\n```\n\nStdout will should log: `utf8` .\n\n### Detect from String\n\n```js\ncharset(res.headers['content-type']);\n```\n\n### Detect combine with [jschardet]\n\nAs you know, `charset` only detect from http response headers and html content-type meta tag.\nYou can combine with [jschardet] to help you detect the finally charset.\n\nThis example codes come from [stackoverflow#12326688](http://stackoverflow.com/a/18712021/2496088):\n\n```js\nvar request = require('request');\nvar charset = require('charset');\nvar jschardet = require('jschardet');\n\nrequest({\n  url: 'http://www.example.com',\n  encoding: null\n}, function (err, res, body) {\n  if (err) {\n    throw err;\n  }\n  enc = charset(res.headers, body);\n  enc = enc || jschardet.detect(body).encoding.toLowerCase();\n  console.log(enc);\n});\n```\n\n## License\n\n[MIT](LICENSE.txt)\n\n[jschardet]: https://github.com/aadsm/jschardet\n",
  "repository": {
    "type": "git",
    "url": "git://github.com/node-modules/charset.git"
  },
  "users": {
    "stanzhai": true,
    "krot47": true,
    "zuojiang": true
  },
  "bugs": {
    "url": "https://github.com/node-modules/charset/issues"
  },
  "license": "MIT",
  "versions": {
    "0.0.1": {
      "name": "charset",
      "version": "0.0.1",
      "description": "Get the content charset from header and html content-type.",
      "main": "index.js",
      "directories": {
        "test": "test"
      },
      "scripts": {
        "test": "make test"
      },
      "devDependencies": {
        "should": "*",
        "mocha": "*"
      },
      "repository": {
        "type": "git",
        "url": "git://github.com/fengmk2/charset.git"
      },
      "keywords": [
        "charset",
        "content-type",
        "ContentType"
      ],
      "author": {
        "name": "fengmk2",
        "email": "fengmk2@gmail.com"
      },
      "license": "MIT",
      "_id": "charset@0.0.1",
      "dist": {
        "shasum": "482d4e3fcbac96423f3af72bec7e640b6d43b7f0",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/charset/-/charset-0.0.1.tgz",
        "integrity": "sha512-rhxb58rQre3j05mL+Ck8zwp3nbWgaKoYh7IW1ZuQIyLEvvf+XBiV+C0OEWXzN/dzdWlddCYszIyiASsfyOn25g==",
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEUCIEudDpeaqSKVKkVmg0CHfu3Vrvh/8rjwGtj+bJ6WtoqyAiEA3vU5clyjLsJs7VE2Jm6FlQznrEwhVZjuxD1MAQzzyHQ="
          }
        ]
      },
      "_npmVersion": "1.1.61",
      "_npmUser": {
        "name": "fengmk2",
        "email": "fengmk2@gmail.com"
      },
      "maintainers": [
        {
          "name": "fengmk2",
          "email": "fengmk2@gmail.com"
        }
      ]
    },
    "0.0.2": {
      "name": "charset",
      "version": "0.0.2",
      "description": "Get the content charset from header and html content-type.",
      "main": "index.js",
      "scripts": {
        "test": "make test-all"
      },
      "config": {
        "blanket": {
          "pattern": "charset/lib"
        },
        "travis-cov": {
          "threshold": 100
        }
      },
      "dependencies": {},
      "devDependencies": {
        "autod": "*",
        "blanket": "*",
        "contributors": "*",
        "cov": "*",
        "coveralls": "*",
        "mocha": "*",
        "mocha-lcov-reporter": "*",
        "should": "3.0.1"
      },
      "homepage": "https://github.com/fengmk2/charset",
      "repository": {
        "type": "git",
        "url": "git://github.com/fengmk2/charset.git"
      },
      "keywords": [
        "charset",
        "content-type",
        "ContentType",
        "Content-Type",
        "xml",
        "encoding"
      ],
      "author": {
        "name": "fengmk2",
        "email": "fengmk2@gmail.com",
        "url": "http://fengmk2.github.com"
      },
      "license": "MIT",
      "contributors": [
        {
          "name": "fengmk2",
          "email": "fengmk2@gmail.com",
          "url": "https://github.com/fengmk2"
        },
        {
          "name": "Oleg Slobodskoi",
          "email": "oleg008@gmail.com",
          "url": "https://github.com/kof"
        }
      ],
      "bugs": {
        "url": "https://github.com/fengmk2/charset/issues"
      },
      "_id": "charset@0.0.2",
      "dist": {
        "shasum": "b8856d86d564c9dd74a7e3a4e7da4407456cec59",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/charset/-/charset-0.0.2.tgz",
        "integrity": "sha512-5zUOURhIknfJViuEGa/BjJCX+Ru6A4Rm61HVOEv7ony4Z9BvuKnwPa9F9JTNLTqwyWtlVEHxHj4TGOeutgboUw==",
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEQCIDiJE0DGj0drLtVR1zTVPuo1sN4WLgFHuV4upNnHXxJfAiAWZpTDuXiJKghsBRNF1pA87pfENUStxx1bD/RwzYiSNw=="
          }
        ]
      },
      "_from": ".",
      "_npmVersion": "1.3.21",
      "_npmUser": {
        "name": "fengmk2",
        "email": "fengmk2@gmail.com"
      },
      "maintainers": [
        {
          "name": "fengmk2",
          "email": "fengmk2@gmail.com"
        }
      ]
    },
    "0.1.0": {
      "name": "charset",
      "version": "0.1.0",
      "description": "Get the content charset from header and html content-type.",
      "main": "index.js",
      "scripts": {
        "test": "make test-all"
      },
      "config": {
        "blanket": {
          "pattern": "charset/lib"
        },
        "travis-cov": {
          "threshold": 100
        }
      },
      "dependencies": {},
      "devDependencies": {
        "autod": "*",
        "blanket": "*",
        "contributors": "*",
        "cov": "*",
        "coveralls": "*",
        "mocha": "*",
        "mocha-lcov-reporter": "*",
        "should": "~4.0.4"
      },
      "homepage": "https://github.com/node-modules/charset",
      "repository": {
        "type": "git",
        "url": "git://github.com/node-modules/charset.git"
      },
      "keywords": [
        "charset",
        "content-type",
        "ContentType",
        "Content-Type",
        "xml",
        "encoding"
      ],
      "author": {
        "name": "fengmk2",
        "email": "fengmk2@gmail.com",
        "url": "http://fengmk2.github.com"
      },
      "license": "MIT",
      "contributors": [
        {
          "name": "fengmk2",
          "email": "fengmk2@gmail.com",
          "url": "https://github.com/fengmk2"
        },
        {
          "name": "kof",
          "email": "oleg008@gmail.com",
          "url": "https://github.com/kof"
        }
      ],
      "gitHead": "b36c23553eb08eed0388ca85d352c67bec4954dd",
      "bugs": {
        "url": "https://github.com/node-modules/charset/issues"
      },
      "_id": "charset@0.1.0",
      "_shasum": "032b4ed95bba940f2c7241e0e890e6bbae569442",
      "_from": ".",
      "_npmVersion": "1.4.13",
      "_npmUser": {
        "name": "fengmk2",
        "email": "fengmk2@gmail.com"
      },
      "maintainers": [
        {
          "name": "fengmk2",
          "email": "fengmk2@gmail.com"
        }
      ],
      "dist": {
        "shasum": "032b4ed95bba940f2c7241e0e890e6bbae569442",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/charset/-/charset-0.1.0.tgz",
        "integrity": "sha512-3VeLCam5//zzz/918zX6V0v0Mj4ng+p9gKupCcl017wLTf78eilm7wnh71uPQmCVrc/iAXvCpkF7B5Xhjn/qTg==",
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEQCIDcboub2mtdvhtLn8CSc881vdqOfBbWeg5hzk04593SHAiAoddJ5Ur/VIGEH7bFZVBF0/LwTSOxrLAsyWJiQxmsgcw=="
          }
        ]
      }
    },
    "1.0.0": {
      "name": "charset",
      "version": "1.0.0",
      "description": "Get the content charset from header and html content-type.",
      "main": "index.js",
      "scripts": {
        "test": "make test-all"
      },
      "config": {
        "blanket": {
          "pattern": "charset/lib"
        },
        "travis-cov": {
          "threshold": 100
        }
      },
      "dependencies": {},
      "devDependencies": {
        "autod": "*",
        "blanket": "*",
        "contributors": "*",
        "cov": "*",
        "coveralls": "*",
        "mocha": "*",
        "mocha-lcov-reporter": "*",
        "should": "~4.0.4"
      },
      "homepage": "https://github.com/node-modules/charset",
      "repository": {
        "type": "git",
        "url": "git://github.com/node-modules/charset.git"
      },
      "keywords": [
        "charset",
        "content-type",
        "ContentType",
        "Content-Type",
        "xml",
        "encoding"
      ],
      "author": {
        "name": "fengmk2",
        "email": "fengmk2@gmail.com",
        "url": "http://fengmk2.github.com"
      },
      "license": "MIT",
      "contributors": [
        {
          "name": "fengmk2",
          "email": "fengmk2@gmail.com",
          "url": "https://github.com/fengmk2"
        },
        {
          "name": "kof",
          "email": "oleg008@gmail.com",
          "url": "https://github.com/kof"
        }
      ],
      "gitHead": "05d4b07959019655d08ab59427d2b99b610327c8",
      "bugs": {
        "url": "https://github.com/node-modules/charset/issues"
      },
      "_id": "charset@1.0.0",
      "_shasum": "19327217c249c912e964efbd47f56cc254c348d9",
      "_from": ".",
      "_npmVersion": "2.0.0-beta.3",
      "_npmUser": {
        "name": "fengmk2",
        "email": "fengmk2@gmail.com"
      },
      "maintainers": [
        {
          "name": "fengmk2",
          "email": "fengmk2@gmail.com"
        }
      ],
      "dist": {
        "shasum": "19327217c249c912e964efbd47f56cc254c348d9",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/charset/-/charset-1.0.0.tgz",
        "integrity": "sha512-koQGAEXbNHlaiNlUo4OSH3x8awp8XZHS2Q6Pzws0JRTiR8f/3PZpdr2ZWEBq/rC37+QqN7025BBsSvQYchhnIg==",
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEMCIHpv930TMkQuajsMl98amdQJGG8Cqg+1dymL001D0oS0Ah8dVkBDAHgw/SSRQSKj/xdWRSXwOaCuqLQBcluYZMuW"
          }
        ]
      }
    },
    "1.0.1": {
      "name": "charset",
      "version": "1.0.1",
      "description": "Get the content charset from header and html content-type.",
      "main": "index.js",
      "scripts": {
        "test": "npm run lint && egg-bin test",
        "ci": "npm run lint && egg-bin cov",
        "lint": "eslint test *.js"
      },
      "dependencies": {},
      "devDependencies": {
        "egg-bin": "1",
        "egg-ci": "^1.1.0",
        "eslint": "4",
        "eslint-config-egg": "5"
      },
      "homepage": "https://github.com/node-modules/charset",
      "repository": {
        "type": "git",
        "url": "git://github.com/node-modules/charset.git"
      },
      "keywords": [
        "charset",
        "content-type",
        "ContentType",
        "Content-Type",
        "xml",
        "encoding"
      ],
      "engines": {
        "node": ">=4.0.0"
      },
      "ci": {
        "version": "4, 6, 8"
      },
      "author": {
        "name": "fengmk2",
        "email": "fengmk2@gmail.com",
        "url": "https://fengmk2.com"
      },
      "license": "MIT",
      "contributors": [
        {
          "name": "fengmk2",
          "email": "fengmk2@gmail.com",
          "url": "https://github.com/fengmk2"
        },
        {
          "name": "Oleg Slobodskoi",
          "email": "oleg008@gmail.com",
          "url": "https://github.com/kof"
        }
      ],
      "gitHead": "dcc48ee609a9b8a137c68faad712c646fcaeda29",
      "bugs": {
        "url": "https://github.com/node-modules/charset/issues"
      },
      "_id": "charset@1.0.1",
      "_npmVersion": "5.3.0",
      "_nodeVersion": "8.4.0",
      "_npmUser": {
        "name": "fengmk2",
        "email": "fengmk2@gmail.com"
      },
      "dist": {
        "integrity": "sha512-6dVyOOYjpfFcL1Y4qChrAoQLRHvj2ziyhcm0QJlhOcAhykL/k1kTUPbeo+87MNRTRdk2OIIsIXbuF3x2wi5EXg==",
        "shasum": "8d59546c355be61049a8fa9164747793319852bd",
        "tarball": "https://archive.ito.gov.ir/npm/_packages/charset/-/charset-1.0.1.tgz",
        "signatures": [
          {
            "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
            "sig": "MEUCIQDf2iQZ7hIcWJQozOc1btfvJaMeHPoHLq8oIkAgBK/s+wIgLZXHLfVeuQbHkDbm8I/hahKe3i0GomNZkatkzeznb1c="
          }
        ]
      },
      "maintainers": [
        {
          "name": "fengmk2",
          "email": "fengmk2@gmail.com"
        }
      ],
      "_npmOperationalInternal": {
        "host": "s3://npm-registry-packages",
        "tmp": "tmp/charset-1.0.1.tgz_1504753230155_0.8552967752330005"
      }
    }
  },
  "name": "charset",
  "time": {
    "modified": "2026-08-25T06:36:42.984Z",
    "created": "2012-10-08T12:01:20.657Z",
    "0.0.1": "2012-10-08T12:01:27.978Z",
    "0.0.2": "2014-01-19T12:44:35.269Z",
    "0.1.0": "2014-07-05T12:42:11.383Z",
    "1.0.0": "2014-09-17T13:59:01.291Z",
    "1.0.1": "2017-09-07T03:00:30.260Z"
  },
  "readmeFilename": "README.md",
  "contributors": [
    {
      "name": "fengmk2",
      "email": "fengmk2@gmail.com",
      "url": "https://github.com/fengmk2"
    },
    {
      "name": "Oleg Slobodskoi",
      "email": "oleg008@gmail.com",
      "url": "https://github.com/kof"
    }
  ],
  "homepage": "https://github.com/node-modules/charset"
}