{"id":23223039,"url":"https://github.com/dckt/basic-upload","last_synced_at":"2025-04-05T16:29:47.007Z","repository":{"id":146972517,"uuid":"49368272","full_name":"DCKT/basic-upload","owner":"DCKT","description":"Simple file upload for express","archived":false,"fork":false,"pushed_at":"2016-01-10T21:36:12.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-11T13:28:29.220Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/DCKT.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-01-10T13:39:49.000Z","updated_at":"2016-01-10T13:40:54.000Z","dependencies_parsed_at":"2023-04-18T01:54:29.623Z","dependency_job_id":null,"html_url":"https://github.com/DCKT/basic-upload","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DCKT%2Fbasic-upload","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DCKT%2Fbasic-upload/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DCKT%2Fbasic-upload/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/DCKT%2Fbasic-upload/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/DCKT","download_url":"https://codeload.github.com/DCKT/basic-upload/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247365082,"owners_count":20927263,"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":[],"created_at":"2024-12-18T23:15:52.722Z","updated_at":"2025-04-05T16:29:46.971Z","avatar_url":"https://github.com/DCKT.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Basic upload\n\nUpload file easly, that's it !\n\n## Requirement\nYou need to use the latest stable version of Node.js (4.2 or higher)\n\n## How it works\n\nThe module deserve an **upload** function which use `Promise`.\nThe files are stored in the directory **uploads** at the top of your application.\n\n## Example \n```js\nconst upload = require('basic-upload');\n\n// /uploads deserve static files\napp.use(express.static(path.join(__dirname, '../uploads')));\n\n// assuming an express app\n// don't forget to enable multipart/form-data \napp.post('/pictures/new', function(req, res) {\n  const product = req.body.pictures;\n\n  upload({\n    file: req.files.picture,  // unique file\n    files: req.files.gallery, // array of file\n    parentDirectory: 'pictures', \n    dirname: product.ref\n  })\n    .then(filesUploaded =\u003e {\n      Picture.create({\n        path: filesUploaded[0].path,\n        name: filesUploaded[0].fileName,\n      })\n        .then(() =\u003e {\n          res.redirect('/');\n        });\n    })\n    .catch(err =\u003e {\n      console.error(err);\n    })\n});\n```\n\n## API\n\n**function upload(params)**\nparams is an object who can hold :\n\n- file: unique file\n- files: array of files\n- parentDirectory: name of the parent directory\n- dirname : name of the directory where the files will be uploaded\n\nThe function resolve a filesUploaded variable which is an array of object who contain the filename and the path for each file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdckt%2Fbasic-upload","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdckt%2Fbasic-upload","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdckt%2Fbasic-upload/lists"}