-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bb23b9b
commit a10059f
Showing
31 changed files
with
2,209 additions
and
2,305 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,17 +14,17 @@ jobs: | |
|
||
strategy: | ||
matrix: | ||
node-version: [14.x, 16.x, 18.x, 20.x] | ||
node-version: [18.x, 20.x] | ||
|
||
steps: | ||
- uses: actions/[email protected] | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/[email protected] | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: npm install and test | ||
run: | | ||
npm ci | ||
npm test | ||
env: | ||
CI: true | ||
- uses: actions/[email protected] | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/[email protected] | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: npm install and test | ||
run: | | ||
npm ci | ||
npm test | ||
env: | ||
CI: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ jobs: | |
- uses: actions/[email protected] | ||
- uses: actions/[email protected] | ||
with: | ||
node-version: 16 | ||
node-version: 20 | ||
- run: npm ci | ||
- run: npm test | ||
|
||
|
@@ -22,7 +22,7 @@ jobs: | |
- uses: actions/[email protected] | ||
- uses: actions/[email protected] | ||
with: | ||
node-version: 16 | ||
node-version: 20 | ||
registry-url: https://registry.npmjs.org/ | ||
- run: npm ci | ||
- run: npm publish | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Ignore artifacts: | ||
build | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,44 @@ | ||
var app = require('express')(); | ||
var archiver = require('archiver'); | ||
var p = require('path'); | ||
var app = require("express")(); | ||
var archiver = require("archiver"); | ||
var p = require("path"); | ||
|
||
app.get('/', function(req, res) { | ||
app.get("/", function (req, res) { | ||
var archive = archiver("zip"); | ||
|
||
var archive = archiver('zip'); | ||
|
||
archive.on('error', function(err) { | ||
res.status(500).send({error: err.message}); | ||
archive.on("error", function (err) { | ||
res.status(500).send({ error: err.message }); | ||
}); | ||
|
||
//on stream closed we can end the request | ||
archive.on('end', function() { | ||
console.log('Archive wrote %d bytes', archive.pointer()); | ||
archive.on("end", function () { | ||
console.log("Archive wrote %d bytes", archive.pointer()); | ||
}); | ||
|
||
//set the archive name | ||
res.attachment('archive-name.zip'); | ||
res.attachment("archive-name.zip"); | ||
|
||
//this is the streaming magic | ||
archive.pipe(res); | ||
|
||
var files = [__dirname + '/fixtures/file1.txt', __dirname + '/fixtures/file2.txt']; | ||
var files = [ | ||
__dirname + "/fixtures/file1.txt", | ||
__dirname + "/fixtures/file2.txt", | ||
]; | ||
|
||
for(var i in files) { | ||
for (var i in files) { | ||
archive.file(files[i], { name: p.basename(files[i]) }); | ||
} | ||
|
||
var directories = [__dirname + '/fixtures/somedir'] | ||
var directories = [__dirname + "/fixtures/somedir"]; | ||
|
||
for(var i in directories) { | ||
archive.directory(directories[i], directories[i].replace(__dirname + '/fixtures', '')); | ||
for (var i in directories) { | ||
archive.directory( | ||
directories[i], | ||
directories[i].replace(__dirname + "/fixtures", ""), | ||
); | ||
} | ||
|
||
archive.finalize(); | ||
|
||
}); | ||
|
||
app.listen(3000); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,27 @@ | ||
var fs = require('fs'); | ||
var fs = require("fs"); | ||
|
||
var archiver = require('archiver'); | ||
var archiver = require("archiver"); | ||
|
||
var output = fs.createWriteStream(__dirname + '/example-output.tar'); | ||
var archive = archiver('tar'); | ||
var output = fs.createWriteStream(__dirname + "/example-output.tar"); | ||
var archive = archiver("tar"); | ||
|
||
output.on('close', function() { | ||
console.log(archive.pointer() + ' total bytes'); | ||
console.log('archiver has been finalized and the output file descriptor has closed.'); | ||
output.on("close", function () { | ||
console.log(archive.pointer() + " total bytes"); | ||
console.log( | ||
"archiver has been finalized and the output file descriptor has closed.", | ||
); | ||
}); | ||
|
||
archive.on('error', function(err) { | ||
archive.on("error", function (err) { | ||
throw err; | ||
}); | ||
|
||
archive.pipe(output); | ||
|
||
var file1 = __dirname + '/fixtures/file1.txt'; | ||
var file2 = __dirname + '/fixtures/file2.txt'; | ||
var file1 = __dirname + "/fixtures/file1.txt"; | ||
var file2 = __dirname + "/fixtures/file2.txt"; | ||
|
||
archive | ||
.append(fs.createReadStream(file1), { name: 'file1.txt' }) | ||
.append(fs.createReadStream(file2), { name: 'file2.txt' }) | ||
.finalize(); | ||
.append(fs.createReadStream(file1), { name: "file1.txt" }) | ||
.append(fs.createReadStream(file2), { name: "file2.txt" }) | ||
.finalize(); |
Oops, something went wrong.