Gathering detailed insights and metrics for file-push-webpack-plugin
Gathering detailed insights and metrics for file-push-webpack-plugin
Gathering detailed insights and metrics for file-push-webpack-plugin
Gathering detailed insights and metrics for file-push-webpack-plugin
This is webpack plugin for sending a zip file to server.
npm install file-push-webpack-plugin
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
1,419
Last Day
1
Last Week
9
Last Month
24
Last Year
194
MIT License
18 Commits
1 Watchers
1 Branches
1 Contributors
Updated on Mar 07, 2019
Minified
Minified + Gzipped
Latest Version
1.0.4
Package Id
file-push-webpack-plugin@1.0.4
Unpacked Size
10.42 kB
Size
3.71 kB
File Count
8
NPM Version
6.4.1
Node Version
10.13.0
Cumulative downloads
Total Downloads
Last Day
0%
1
Compared to previous day
Last Week
80%
9
Compared to previous week
Last Month
-36.8%
24
Compared to previous month
Last Year
39.6%
194
Compared to previous year
3
4
This is webpack plugin for sending a zip file to server.
1module.export = { 2 ... 3 plugins: [ 4 ... 5 new FilePushWebpackPlugin({ 6 url: 'the url you want to send the zip', 7 regex: /.*\.map$/, 8 shouldRemoveFiles: true, 9 }), 10 ] 11}
param | detail | default value |
---|---|---|
regex | find files with a regex. | null |
shouldRemoveFiles | delete certain files after uploading zip-file | true |
url | the url which your zip-file will be sent to | null |
zipFileName | name for zip file | temp.zip |
success | success callback | null |
fail | error callback | null |
If you use koa as your node server, the example below may help you to get the zip-file.
Maybe you use koa-body or others lib that can parse formdata. And, you may need a tool to decompress your zip. I recommend the adm-zip for your first choice.
I assume that you use koa-body
and adm-zip
.
1const router = require('koa-router')(); 2const koaBody = require('koa-body'); 3const fs = require('fs'); 4const admZip = require('adm-zip'); 5 6router.post('/xxx', koaBody({ 7 multipart: true, 8 formidable: { 9 maxFileSize: 2000*1024*1024, // you decide 10 } 11}), async (ctx) => { 12 // This Plugin will send the file with name 'zipFile' 13 const { zipFile } = ctx.request.files; 14 if (!zipFile) { 15 throw Error('no zip'); 16 } 17 try { 18 const [filename] = zipFile.name.split('.'); 19 const zip = new admZip(zipFile.path); 20 const dir = `./${filename}`; 21 if (!fs.existsSync(dir)) { 22 fs.mkdirSync(dir); 23 } 24 zip.extractAllTo(dir); 25 } catch (e) { 26 console.log(e); 27 } 28});
1const multipart = require('connect-multiparty'); 2const multipartMiddleware = multipart(); 3app.use('/xxx', multipartMiddleware, function(req, res) { 4 const { zipFile } = req.files; 5 if (!zipFile) { 6 throw Error('no zip'); 7 } 8 try { 9 const { path: filePath, originalFilename } = zipFile; 10 const [filename] = originalFilename.split('.'); 11 const zip = new admZip(filePath); 12 const dir = path.join(__dirname, `${filename}`); 13 if (!fs.existsSync(dir)) { 14 fs.mkdirSync(dir); 15 } 16 zip.extractAllTo(dir); 17 fs.unlinkSync(filePath); 18 } catch (e) { 19 console.log(e); 20 } 21 res.end(); 22});
MIT.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/18 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
23 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-05-05
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More