always use gzip when uploading

This commit is contained in:
moloch--
2020-06-07 09:55:17 -05:00
parent 4526dd2b44
commit 73147adf83
2 changed files with 4 additions and 8 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "sliver-script",
"version": "1.0.14",
"version": "1.0.15",
"description": "TypeScript/JavaScript Sliver client library",
"main": "lib/index.js",
"types": "lib/index.d.ts",
+3 -7
View File
@@ -186,17 +186,13 @@ export class InteractiveSession {
});
}
upload(path: string, encoder: string, data: Buffer, timeout = TIMEOUT): Promise<sliverpb.Upload> {
upload(path: string, data: Buffer, timeout = TIMEOUT): Promise<sliverpb.Upload> {
return new Promise(async (resolve, reject) => {
const req = new sliverpb.UploadReq();
req.setPath(path);
req.setEncoder(encoder);
req.setEncoder('gzip');
let payload = data;
if (encoder === 'gzip') {
payload = await gzip(data)
} else if (encoder !== '') {
return reject(`Unsupported encoder ${encoder}`)
}
payload = await gzip(data)
req.setData(payload);
req.setRequest(this.request(timeout));
this._rpc.upload(req, this.deadline(timeout), (err, upload) => {