This is a small tool only for multipart/form-data request
This is served on nodejs env as a middleware. It only depends on nodejs one native package: fs, for saving posted image.
API
Example
Server Side
const express = // for cross-origin-request-securiy, this is set 'Access-Control-Allow-Origin: *', Forbidden to deploy on production!const cors = const app = const parse = appapp // directory for posted picture, need create manually app app
Client Side
Import following script in html, then the picture you dsignated will transfer to destination automatically.
const url = 'http://localhost:8602'const formData = // To create Image Blob, you can use any method to generate a blob type. { return { const img = ; const c = document; const ctx = c; img { cwidth = thisnaturalWidth; // update canvas size to match image cheight = thisnaturalHeight; ctx; // draw in image c; // save to blob }; imgcrossOrigin = "" imgsrc = src }}