largedata (beta)
formdata and file uploads.
Features
- getting form input element and data attributes
- multiple upload
- setting up network speed
(for only clients)
- realtime stats
- overwrite mode
- limited upload (mime-type)
- reject option
Install - npm i largedata --save
interface graphic desing
Madalina Taina @MadyTzn
Example upload project:
Example Project or @github/largedata/sample_upload_project/
Node.Js - server.js
const ld = default;
const option = encoding:'binary' // file encoder storage:"./" // your upload folder location overwrite: true // file overwrite option mime_types : // accepts only your trusted list (empty accepts all)
// Express Application app
//Largedata Application ld
server.js (files,fields) output
formdata (files) paramater :
done: true storage: './' name: 'test_10.iso' size: '10.00MB'
formdata (fields) paramater :
attribute: type: 'text' style: 'width: 100px;' name: 'test_input' large: 'your data attr' test: 'some numbers 123456' custom: 'your custom type' id: 'test_input' value: 'hello'
HTML - example form
HTML - client (network,upload,error) stats output
Upload done (output)
"code":"0003" "msg":"FINISHED" "list": "name":"test_text_100.txt""size":"100.0MB""mime":"text/plain" "name":"test_iso_1.iso""size":"1.0GB""mime":"" "name":"test_video_5.mp4""size":"5.0GB""mime":"video/mp4"
Your custom data from server to client (output)
"code":"0005""msg":"SUCCESS""response": "hello":"Good Morning" "language_test":"testing some different languages :> Günaydın, доброе утро, शुभ प्रभात ,добрий ранок, おはようございます, 早上好, buổi sáng tốt lành"
Upload current process(output)
"code":"0004" "msg":"UPLOADING" "name":"test_video_5.mp4" "percent":"20"
Network (output)
"network": "speed":"1.0" "prefix":"Mbps" "type":"ADSL,LAN,3G,4G" "time": "hour":"1" "minute":"20"
network speed a valid only on the upload proccess. This option is unusable from for the sending form elements.
overwrite (default: true) type: "boolean"
if your set the "false", upload attempt is rejected.
mime_types (default:empty) type: "array"
accepts only your own mime-type list for upload.
//EXAMPLE LIST mime_types : "application/javascript" "application/json" "application/zip" "audio/mpeg" "image/gif" "image/jpeg""image/png" "text/css" "text/html" "text/php""text/plain" "your mime type here" "etc.."
.reject("your message")
now you can allowed or rejected client formdata to on the server side.
//reject function example usage in express applicationapp
Note: if you had the js file path issue on the browser side then you can try changing to full path like
http://<your_host>/<api_url>/largedata.min.js
or semi url<api_url>/largedata.min.js
Build: Node.js,Ts,Js,WebApi