{"id":22239615,"url":"https://github.com/nodeclient/largedata","last_synced_at":"2025-03-25T10:15:43.702Z","repository":{"id":143885099,"uuid":"276177746","full_name":"Nodeclient/largedata","owner":"Nodeclient","description":"Npm Package - formdata and file uploads.","archived":false,"fork":false,"pushed_at":"2021-12-08T05:04:34.000Z","size":330,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-23T08:35:17.376Z","etag":null,"topics":["form","form-attributes","form-elements","formdata","formdata-support","html","javascript-upload","largedata","mime","multi-upload","node-js","stats","upload","upload-file","uploader"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/~nodeclient","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Nodeclient.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-30T18:25:09.000Z","updated_at":"2021-12-08T05:04:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"73899a87-0a5e-4b00-a332-75f3ea9e79be","html_url":"https://github.com/Nodeclient/largedata","commit_stats":{"total_commits":181,"total_committers":2,"mean_commits":90.5,"dds":0.07734806629834257,"last_synced_commit":"230945b93741132ddd1d976605d73a936fdf76dd"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nodeclient%2Flargedata","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nodeclient%2Flargedata/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nodeclient%2Flargedata/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Nodeclient%2Flargedata/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Nodeclient","download_url":"https://codeload.github.com/Nodeclient/largedata/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245440576,"owners_count":20615633,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["form","form-attributes","form-elements","formdata","formdata-support","html","javascript-upload","largedata","mime","multi-upload","node-js","stats","upload","upload-file","uploader"],"created_at":"2024-12-03T03:20:14.392Z","updated_at":"2025-03-25T10:15:43.641Z","avatar_url":"https://github.com/Nodeclient.png","language":"JavaScript","readme":"# largedata (beta)\n\n### formdata and file uploads.\n![npm](https://img.shields.io/npm/v/largedata.svg?style=flat) ![npm](https://img.shields.io/npm/dt/largedata) ![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)\n\n[![Image from Gyazo](https://i.gyazo.com/38fa7ce28575659edb83fdbe3e71b255.gif)](https://gyazo.com/38fa7ce28575659edb83fdbe3e71b255)\n \n\n## Features\n- [x] getting form input element and data attributes\n- [x] multiple upload\n- [x] setting up network speed `(for only clients)`\n- [x] realtime stats\n- [x] overwrite mode\n- [x] restricted file mime-types\n- [x] reject option for server side\n\n\n**Install** - ```npm i largedata --save```\n\n\n### interface graphic desing\n**Madalina Taina** [@MadyTzn](https://twitter.com/MadyTzn)  \n\n### Example upload project:\n[Example Project](https://git.io/JJUck) or ***@github***/largedata/sample_upload_project/\n\n---\nNode.Js -  ```server.js```\n\n```javascript\nconst ld = require('largedata').default;\n```\n```javascript\nconst option = { \n    encoding:'binary',  // type [string]  : file encoder\n    storage:\"./\",       // type [string]  : your upload folder location\n    overwrite: true,    // type [boolean] : file overwrite option\n    mime_types : []     // type [Array]   : accepts only selected files (empty: accepts all)\n}\n```\n\n```javascript\n  // Express.js\n  app.use('/upload',ld.router,function (req, res, next) {\n    /* sample reject option\n    \tld.reject(\"Permission denied !\")\n    */\n    res.render(\"pages/index\",{ title:\"render your upload html\" });\n  }) \n```\n\n```javascript\n  ld.formdata(option,function (fields,files,client){\n    if(files){ // Input files (It's only return the successful uploads)\n     console.log(files);\n    }\n    if(fields){ // HTML input elements \u0026 attributes\n      for (const items of fields) {\n        console.log( items );\n\t\n\t client.post({ \n\t\t  hello: \"Good Morning\",\n\t\t  language_test: \"testing some different languages :\u003e Günaydın, доброе утро, \n\t\t  शुभ प्रभात ,добрий ранок, おはようございます, 早上好, buổi sáng tốt lành\"\n\t  });  // send data-object from server to client (status:0005)\n\t  \n      }\n    }\n\n  })\n```\n---\n### server.js (files,fields) output\n`formdata (files) paramater :`\n```js\n {\n  done: true,\n  storage: './',\n  name: 'test_10.iso',\n  size: '10.00MB'\n }\n```\n\n`formdata (fields) paramater :`\n```js\n{\n  attribute: [\n   { type: 'text' },\n   { style: 'width: 100px;' },\n   { name: 'test_input' },\n   { large: 'your data attr' },\n   { test: 'some numbers 123456' },\n   { custom: 'your custom type' },\n  ],\n id: 'test_input',\n value: 'hello'\n}\n```\n---\n\n### HTML - example form\n```html\n\u003c! DOCTYPE html \u003e\n\u003chtml\u003e\n\u003cscript src=\"https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js\"\u003e\u003c/script\u003e\n\u003ccenter\u003e\n  \u003cform id=\"my_upload\"\u003e\n    \u003cinput type='range' id=\"your_range\"  /\u003e\u003cbr\u003e\n    \u003cinput type='text' style=\"width: 100px;\" name=\"test_input\" custom=\"your custom type\" data-large=\"your data attr\" data-test=\"some numbers 123456\" /\u003e\u003cbr\u003e\u003cbr\u003e\n    \u003cinput type='file' multiple /\u003e\n      \u003cinput type=\"button\" id=\"send\" value=\"Submit\"/\u003e\n      \u003cbr\u003e\u003cbr\u003e\n    \u003cdiv id='output_div' /\u003e\n  \u003c/form\u003e\n  \u003c/center\u003e\n\u003c/html\u003e\n\n\u003cscript\u003e\n    jQuery('#send').click(function(){\n      // OUTPUT_DIV\n      var info_output = document.getElementById(\"info_div\");\n      //OPTIONS\n      const Options = {\n        form_id : \"my_upload\",    // Form id\n        speed : \"8000\",          // Network speed type(Kbps) -\u003e 1000Kbps = 1Mbps\n        post_url : \"/upload\",   // Post data url\n      }\n      SendForm = new LargeData(Options);\n      //UPLOAD INPUT FILES\n      SendForm.upload(function( upload_stats , network_stats , err ) {\n\t//OUTPUT_DIV\n        info_output.innerHTML = JSON.stringify(upload_stats) + \"\u003cbr\u003e\" + \n\t\tJSON.stringify(network_stats)+\"\u003cbr\u003e\" + JSON.stringify(err)\n      })\n      // SEND INPUT FIELDS\n      SendForm.fields(function(form,err) {\n\t//OUTPUT_DIV\n       \tinfo_output.innerHTML = JSON.stringify(form) + \"\u003cbr\u003e\" + JSON.stringify(err)\n      }) \n    });\n\u003c/script\u003e\n\n\u003cscript src=\"largedata.min.js\"\u003e\u003c/script\u003e\n```\n\n### HTML - client (network,upload,error) stats output\n`Upload done (output)`\n\n```js\n{ \n  \"code\":\"0003\",\n  \"msg\":\"FINISHED\",\n    \"list\":[\n        {\"name\":\"test_text_100.txt\",\"size\":\"100.0MB\",\"mime\":\"text/plain\"},\n        {\"name\":\"test_iso_1.iso\",\"size\":\"1.0GB\",\"mime\":\"\"},\n        {\"name\":\"test_video_5.mp4\",\"size\":\"5.0GB\",\"mime\":\"video/mp4\"},\n    ]\n}\n```\n`Your custom data from server to client (output)`\n```js\n{ \"code\":\"0005\",\"msg\":\"SUCCESS\",\"response\":{\n\t\"hello\":\"Good Morning\",\n\t\"language_test\":\"testing some different languages :\u003e Günaydın, доброе утро, \n\t\tशुभ प्रभात ,добрий ранок, おはようございます, 早上好, buổi sáng tốt lành\"}\n}\n```\n\n`Upload current process(output)`\n\n```js\n{ \n   \"code\":\"0004\",\n   \"msg\":\"UPLOADING\",\n   \"name\":\"test_video_5.mp4\",\n   \"percent\":\"20\"\n}\n```\n`Network (output)`\n\n```js\n{ \n  \"network\": { \n      \"speed\":\"1.0\",\n\t  \"prefix\":\"Mbps\",\n\t  \"type\":\"ADSL,LAN,3G,4G\"\n   },\n \"time\": {\n    \"hour\":\"1\",\n    \"minute\":\"20\" \n }\n}\n```\n\n\n\u003e **network speed** \n\ta valid only on the upload proccess. This option is unusable from for the sending form elements.\n\n\u003e **overwrite** (default: true)  type: \"boolean\"\n\t`if your set the \"false\", upload attempt is rejected.`\n\n\u003e **mime_types**  (default:empty) type: \"array\" \n\t`accepts only your own mime-type list for upload.`\n\n```js\n   //EXAMPLE LIST\n     mime_types : [ \n     \t\"application/javascript\", \"application/json\", \"application/zip\", \n     \t\"audio/mpeg\", \"image/gif\", \"image/jpeg\",\"image/png\", \"text/css\", \n\t\"text/html\", \"text/php\",\"text/plain\" , \"your mime type here\" , \"etc..\" \n     ]\n```\n\n\u003e **.reject(\"your message\")**  \n\tnow you can allowed or rejected client formdata to on the server side.\n\n```javascript\n//reject function example usage in express application\napp.use('/upload' , largedata.router, function (req, res, next) {\n   largedata.reject(\"Permission denied !\")  // client rejected ... \n     res.render(\"pages/index\",{ title:\"test\" });\n})\n```\n\n\u003e **Note:** \nif you had the js file path issue on the browser side then you can try changing to full path like \n`http://\u003cyour_host\u003e/\u003capi_url\u003e/largedata.min.js` or semi url `\u003capi_url\u003e/largedata.min.js`\n\n\nBuild: `Node.js,Ts,Js,WebApi`\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodeclient%2Flargedata","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnodeclient%2Flargedata","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnodeclient%2Flargedata/lists"}