How to send a buffer in the form of data to SignServer?

I have a file in memory (in the buffer), it does not exist in the file system (so I can’t just pass this).

I am trying to send it to SignServer using HTTP.

Here is how I am trying to do this:

var formdata = require('form-data'); var form = new formdata();

form.append('workerName', 'PDFSigner');
form.append('data', file_buffer);
// or
// escape(file_buffer.toString('binary'))
// or
// file_buffer.toString('binary') (without escaping)

var request = form.submit('http://localhost:8080/signserver/process', function(err, res) {});

When I try to add file_buffer, SignServer says it is dataempty:

Status 400 - Missing file contents on upload

When I try to add escape(file_buffer.toString('binary'))(as suggested in How to send a buffer in an HTTP request? ), This is the same story.

When I try to add file_buffer.toString('binary')node.js, I get a message:

node: ../ src / stream_base.cc: 157 int node :: StreamBase :: Writev (const v8 :: FunctionCallbackInfo &): The statement `(offset) <= (storage_size) 'failed.

( )

() HTTP (multipart/form-data) node.JS?

+4
1

filename data, :

form.append('data', file_buffer, { filename : 'document.pdf' });

( ) : https://github.com/form-data/form-data#alternative-submission-methods ( ).

+7

Source: https://habr.com/ru/post/1676900/


All Articles