git.schokokeks.org
Repositories
Help
Report an Issue
fs-words.git
Code
Commits
Branches
Tags
Suche
Strukturansicht:
6e9c872
Branches
Tags
develop-client_server
master
typescript
fs-words.git
server
lib
node_modules
needle
examples
multipart-stream.js
[add] server:lib:node_modules
Christian Fraß
commited
6e9c872
at 2021-03-08 23:52:07
multipart-stream.js
Blame
History
Raw
var needle = require('./../'); var url = 'http://posttestserver.com/post.php?dir=needle'; var black_pixel = Buffer.from("R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=", 'base64'); var data = { foo: 'bar', nested: { test: 123 }, image: { buffer: black_pixel, content_type: 'image/gif' } } var resp = needle.post(url, data, { multipart: true }); resp.on('readable', function() { while (data = this.read()) { console.log(data.toString()); } }) resp.on('done', function(data) { console.log('Done.'); })