{"_id":"@androbabu/multipart-parser","_rev":"2-af8191ba7dd3f5788f7782a20c0434a8","name":"@androbabu/multipart-parser","dist-tags":{"latest":"1.0.4"},"versions":{"1.0.4":{"name":"@androbabu/multipart-parser","version":"1.0.4","description":"A javascript/nodejs multipart/form-data parser which operates on raw data.","main":"multipart.js","author":{"name":"Cristian Salazar","url":"christiansalazarh@gmail.com"},"license":"MIT","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/freesoftwarefactory/parse-multipart.git"},"keywords":["multipart/form-data","form","fileuploader"],"bugs":{"url":"https://github.com/freesoftwarefactory/parse-multipart/issues"},"homepage":"https://github.com/freesoftwarefactory/parse-multipart#readme","gitHead":"970ed377944fa7ae419c67dfd287d4b328d10bc0","_id":"@androbabu/multipart-parser@1.0.4","_npmVersion":"6.4.1","_nodeVersion":"8.12.0","_npmUser":{"name":"rambabusaravanan","email":"rambabusaravanan@gmail.com"},"dist":{"integrity":"sha512-5llpSLWRJ9JCCd3KBjAQlu3GBvR+R/Ur2fIXq1lazKfDwN+5yuymfk/kxiSHS32YKgOVsyZOrznMm9a0inSvJQ==","shasum":"a5d52f5ed38bba347df431bce30afd77b2146d8b","tarball":"https://registry.npmjs.org/@androbabu/multipart-parser/-/multipart-parser-1.0.4.tgz","fileCount":3,"unpackedSize":8155,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcRCtOCRA9TVsSAnZWagAAtywQAKFgVvbNUbV1ulS8/Zrs\nn0pt4BXhYkYxBx/UMRXU/5SFL2e6dy/1Qe18hD9HY/rMBohNZ3LrBc+k2BE9\ndZCUprfyDiY3InEk3hHXiYsRUck0kMPmoq2Xa0BCeB1kOCTYrRp53bnlRVs7\n/2F/QCjaUmoTZbyqC6d78gRSb24X5tGzfOr91mK6ZvX99/GFaiVqZz+upcgt\nJfw6T66P6egdksapw6+Dm+iNA8doeeamnZfew5WKcga9bxOi5gYlETBXEyys\nl6mEkrqW/B82pSXv6JkNYRSE4FJjbCBbEdjCqzZ/y31/MWqBf00X/HHpTMYb\ni1s0BBdtIfXOUz1YlstE83tWCpPt86tF5akV2JZB6Z+tWEP/rJ7CDxMWI6yq\naZ05UIQWmFIvizvT1gz8XLM41f81Jwhx6H3C25MGOjFWHnGGlQUrjGpu0i5j\niy0NzQaCn5dSOtzzTVPg3F02URuTWWcwIGiwrz5oqIuiqNYT1U7ffpE7URQZ\nt98Jdp6npfNTU++tYTX5uDCsEdlYU8wb7dtAT21D81MEjRgoqsinwIf7bJCK\nifsPL0QHQL+VzgbxE4FRp5hMh67AQ6Y86/n8SJJn6OM/+xw5WVGZG5RqbnlN\nX7O6owQExNQeVZ09VB8kT3UJfqnPYDr6OKm+h+TSO8l7sVMH4MCpveY1NKi1\n74vF\r\n=V6nn\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFIdjEBnXIRI17uI5h93fZT+e5uibgtQPjYqpipe+EImAiBUWFAfXL3h3o6Ox23h4IiSSewL89W2WnAnOAiSrK8tUg=="}]},"maintainers":[{"name":"rambabusaravanan","email":"rambabusaravanan@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/multipart-parser_1.0.4_1547971406089_0.9868411448870698"},"_hasShrinkwrap":false}},"time":{"created":"2019-01-20T08:03:25.950Z","1.0.4":"2019-01-20T08:03:26.243Z","modified":"2022-04-04T14:02:25.826Z"},"maintainers":[],"description":"A javascript/nodejs multipart/form-data parser which operates on raw data.","homepage":"https://github.com/freesoftwarefactory/parse-multipart#readme","keywords":["multipart/form-data","form","fileuploader"],"repository":{"type":"git","url":"git+https://github.com/freesoftwarefactory/parse-multipart.git"},"author":{"name":"Cristian Salazar","url":"christiansalazarh@gmail.com"},"bugs":{"url":"https://github.com/freesoftwarefactory/parse-multipart/issues"},"license":"MIT","readme":"# parse-multipart\n\nA javascript/nodejs multipart/form-data parser which operates on raw data.\n\n# author\n\nCristian Salazar. Email: christiansalazarh@gmail.com, Website: www.chileshift.cl,\ni live in Santiago de Chile. I am Amazon AWS developper focused in Serverless\nsoftware development, i call it: the new age of software development.\n\n# Help & Tutorial\n\nPlease follow me on Twitter [@AmazonAwsVideos](https://twitter.com/amazonawsvideos) and keep informed about more Amazon Aws Videos. Watch my video on which i expose the necesary steps to [implement a Multiform/form-data parser inside a Amazon Aws ApiGateway](https://www.youtube.com/watch?v=BrYJlR0yRnw). You can [subscribe to my channel](https://www.youtube.com/c/ChristianSalazar).\n\n# Background\n\nSometimes you only have access to the raw multipart payload and it needs to be\nparsed in order to extract the files or data contained on it. As an example: \nthe Amazon AWS ApiGateway, which will operate as a facade between the http\nclient and your component (the one written by you designed to extract the \nuploaded files or data). \n\nThe raw payload formatted as multipart/form-data will looks like this one:\n\n```\n------WebKitFormBoundaryDtbT5UpPj83kllfw\nContent-Disposition: form-data; name=\"uploads[]\"; filename=\"somebinary.dat\"\nContent-Type: application/octet-stream\n\nsome binary data...maybe the bits of a image..\n------WebKitFormBoundaryDtbT5UpPj83kllfw\nContent-Disposition: form-data; name=\"uploads[]\"; filename=\"sometext.txt\"\nContent-Type: text/plain\n\nhello how are you\n------WebKitFormBoundaryDtbT5UpPj83kllfw--\n```\n\nThe lines above represents a raw multipart/form-data payload sent by some \nHTTP client via form submission containing two files. We need to extract the \nall files contained inside it. The multipart format allows you to send more \nthan one file in the same payload, that's why it is called: multipart.\n\n# Usage\n\nIn the next lines you can see a implementation. In this case two key values\nneeds to be present:\n\n* body, which can be:\n\n```\n------WebKitFormBoundaryDtbT5UpPj83kllfw\nContent-Disposition: form-data; name=\"uploads[]\"; filename=\"sometext.txt\"\nContent-Type: application/octet-stream\n\nhello how are you\n------WebKitFormBoundaryDtbT5UpPj83kllfw--\n```\n\n* boundary, the string which serve as a 'separator' between parts, it normally\ncomes to you via headers. In this case, the boundary is:\n\n```\n\t----WebKitFormBoundaryDtbT5UpPj83kllfw\n```\n\nNow, having this two key values then you can implement it:\n\n```\n\tvar multipart = require('parse-multipart');\n\tvar body = \"..the multipart raw body..\";\n\tvar boundary = \"----WebKitFormBoundaryDtbT5UpPj83kllfw\";\n\tvar parts = multipart.Parse(body,boundary);\n\t\n\tfor(var i=0;i<parts.length;i++){\n\t\tvar part = parts[i];\n\t\t// will be:\n\t\t// { filename: 'A.txt', type: 'text/plain', \n\t\t//\t\tdata: <Buffer 41 41 41 41 42 42 42 42> }\n\t}\n```\n\nThe returned data is an array of parts, each one described by a filename,\na type and a data, this last one is a Buffer (see also Node Buffer).\n\n\n","readmeFilename":"README.md"}