• The querystring.parse() method parses a URL query string (str) into a collection of key and value pairs.

    For example, the query string 'foo=bar&abc=xyz&abc=123' is parsed into:

    {
    foo: 'bar',
    abc: ['xyz', '123']
    }

    The object returned by the querystring.parse() method _does not_prototypically inherit from the JavaScript Object. This means that typicalObject methods such as obj.toString(), obj.hasOwnProperty(), and others are not defined and will not work.

    By default, percent-encoded characters within the query string will be assumed to use UTF-8 encoding. If an alternative character encoding is used, then an alternative decodeURIComponent option will need to be specified:

    // Assuming gbkDecodeURIComponent function already exists...

    querystring.parse('w=%D6%D0%CE%C4&foo=bar', null, null,
    { decodeURIComponent: gbkDecodeURIComponent });

    Parameters

    • str: string

      The URL query string to parse

    • Optional sep: string

      The substring used to delimit key and value pairs in the query string.

    • Optional eq: string

      . The substring used to delimit keys and values in the query string.

    • Optional options: "querystring".ParseOptions

    Returns "querystring".ParsedUrlQuery

  • The querystring.parse() method parses a URL query string (str) into a collection of key and value pairs.

    For example, the query string 'foo=bar&abc=xyz&abc=123' is parsed into:

    {
    foo: 'bar',
    abc: ['xyz', '123']
    }

    The object returned by the querystring.parse() method _does not_prototypically inherit from the JavaScript Object. This means that typicalObject methods such as obj.toString(), obj.hasOwnProperty(), and others are not defined and will not work.

    By default, percent-encoded characters within the query string will be assumed to use UTF-8 encoding. If an alternative character encoding is used, then an alternative decodeURIComponent option will need to be specified:

    // Assuming gbkDecodeURIComponent function already exists...

    querystring.parse('w=%D6%D0%CE%C4&foo=bar', null, null,
    { decodeURIComponent: gbkDecodeURIComponent });

    Parameters

    • str: string

      The URL query string to parse

    • Optional sep: string

      The substring used to delimit key and value pairs in the query string.

    • Optional eq: string

      . The substring used to delimit keys and values in the query string.

    • Optional options: "querystring".ParseOptions

    Returns "querystring".ParsedUrlQuery

Generated using TypeDoc