1.0.0 • Published 6 years ago
@herzog-ch/post-image-to-server v1.0.0
A Node.js npm package to post an image file to a server using base64-encoding
The package shows how to read a file into a Buffer object and send it to a server via an HTTP POST request. The bytes read from the image file into the Buffer-object are encoded to a base64 string. Read about base64 encoding here: https://de.wikipedia.org/wiki/Base64 These steps are done by the function read_image_base64.
The function post_image sends an HTTP POST request to a given URL using JSON. The base64 encoded image will be embedded in the JSON object. The answer from the server is expected to be in JSON format to and will be returned from the async function post_image as well as the HTTP status of the response.
1.0.0
6 years ago