2.0.0 • Published 5 years ago
formdata-coder v2.0.0
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=example@example.com'
// This is raw form data. You would store the output in a file.
console.log(fdCoder.parse(data))
// { "username":"catsanddogs123", "password":"1234", "email":"example@example.com" }fdCoder.stringify()
const fdCoder = require('formdata-coder');
const data = '{ "username":"catsanddogs123", "password":"1234", "email":"example@example.com" }'
// This could easily be relocated to a file for better space management.
console.log(fdCoder.stringify(data))
// username=catsanddogs123&password=1234&email=example@example.com