form-urlencoded

Encodes `x-www-form-urlencoded` string data

npm install form-urlencoded
8 downloads in the last day
87 downloads in the last week
196 downloads in the last month

form-urlencoded

(c)Bumblehead,JBlashill 2013 MIT-license

OVERVIEW:

form-urlencoded encodes x-www-form-urlencoded string data. It may be used in an ecmascript environment, such as a browser or node.js.

application/x-www-form-urlencoded is a string encoding used, primarily, when an HTML form is submitted. The data from a form will be serialised in this format before it is sent to a server.

This format is not well defined. Serialising complex data, such as a javascript object, is a beyond current specifications.

Server softwares do share methods for handling complex urlencoded data and so there is a "defacto" standard for serializing such data. This is the standard that form-urlencoded follows.


INSTALL:

form-urlencoded may be downloaded directly or installed through npm.

  • npm

    $ npm install form-urlencoded
    
  • Direct Download

    $ git clone https://github.com/iambumblehead/form-urlencoded.git
    

TEST:

to run tests, use npm test from a shell.

 $ npm test

GET STARTED:

  1. Object encoding

    var FormUrlencoded = require('form-urlencoded');
    var result = FormUrlencoded.encode({
     propStr1 : 'str1',
     propStr2 : 'str2',
     propObj1 : { 
       objPropStr1 : 'objStr1', 
       objPropStr2 : 'objStr2'
     }   
    });
    console.log(result);
    //propStr1=str1&propStr2=str2&propObj1%5BobjPropStr1%5D=objStr1&propObj1%5BobjPropStr2%5D=objStr2
    

License:

(The MIT License)

Copyright (c) 2012 Bumblehead chris@bumblehead.com

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

npm loves you