formdata-coder
v2.0.0
Published
This package can parse form data in and out of json.
Readme
Features
formdata-coder includes a way to parse form data to JSON and parse the JSON back to form data. This can be especially useful when fetching endpoints that requires a large amount of form data that you would prefer to not clutter up your workspace.
Examples
There are only two functions of this package, parse, which converts form data to JSON, and stringify, which can convert it back to form data.
fdCoder.parse()
const fdCoder = require('formdata-coder');
const data = 'username=catsanddogs123&password=1234&[email protected]'
// This is raw form data. You would store the output in a file.
console.log(fdCoder.parse(data))
// { "username":"catsanddogs123", "password":"1234", "email":"[email protected]" }fdCoder.stringify()
const fdCoder = require('formdata-coder');
const data = '{ "username":"catsanddogs123", "password":"1234", "email":"[email protected]" }'
// This could easily be relocated to a file for better space management.
console.log(fdCoder.stringify(data))
// username=catsanddogs123&password=1234&[email protected]