forked from EvanOxfeld/node-unzip
-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add node16 + tests, make import conditional, revert formatting changes
- Loading branch information
1 parent
5d05b72
commit 3927030
Showing
3 changed files
with
32 additions
and
2 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
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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const test = require('tap').test; | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const unzip = require('../unzip'); | ||
|
||
const version = +process.version.replace('v', '').split('.')[0]; | ||
|
||
test("get content of a single file entry out of a zip", { skip: version < 16 }, function(t) { | ||
const { S3Client } = require('@aws-sdk/client-s3'); | ||
const client = new S3Client({ region: 'us-east-1' }); | ||
|
||
return unzip.Open.s3_v3(client, { Bucket: 'unzipper', Key: 'archive.zip' }) | ||
.then(function(d) { | ||
const file = d.files.filter(function(file) { | ||
return file.path == 'file.txt'; | ||
})[0]; | ||
|
||
return file.buffer() | ||
.then(function(str) { | ||
const fileStr = fs.readFileSync(path.join(__dirname, '../testData/compressed-standard/inflated/file.txt'), 'utf8'); | ||
t.equal(str.toString(), fileStr); | ||
t.end(); | ||
}); | ||
}); | ||
}); |