Package Exports
- ipfs-multipart
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ipfs-multipart) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
ipfs-multipart
A set of utilities to help dealing with IPFS multipart.
Install
npm i --save ipfs-multipart
Usage
const http = require('http')
const IPFSMultipart = require('ipfs-multipart')
http.createServer((req, res) => {
if (req.method === 'POST' && req.headers['content-type']) {
const parser = IPFSMultipart.reqParser(req)
parser.on('file', (fileName, fileStream) => {
console.log(`file ${fileName} start`)
fileStream.on('data', (data) => {
console.log(`file ${fileName} contents:`, data.toString())
})
fileStream.on('end', (data) => {
console.log(`file ${fileName} end`)
})
})
parser.on('end', () => {
console.log('finished parsing')
res.writeHead(200)
res.end()
})
return
}
res.writeHead(404)
res.end()
}).listen(5001, () => {
console.log('server listening on port 5001')
})
License
MIT